How to convert a file format to utf-8 in Linux?

Member

by adelia , in category: General Help , a month ago

How to convert a file format to utf-8 in Linux?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by mohammad , a month ago

@adelia 

To convert a file format to UTF-8 in Linux, you can use the iconv command. Here's the syntax:

1
iconv -f <source_format> -t UTF-8 <input_file> -o <output_file>


Where:





So, to convert a file named input.txt from the ISO-8859-1 format to UTF-8, you would use the following command:

1
iconv -f ISO-8859-1 -t UTF-8 input.txt -o output.txt


This command will read the content of input.txt, convert it to UTF-8, and save the converted content in output.txt.