I have an Arabic file encoded in ISO8859-15. How can I convert it into UTF8?
I used iconv
but it doesn't work for me.
iconv -f ISO-8859-15 -t UTF-8 Myfile.txt
I wanted to attach the file, but I don't know how.
Click Tools, then select Web options. Go to the Encoding tab. In the dropdown for Save this document as: choose Unicode (UTF-8). Click Ok.
In Linux, the iconv command line tool is used to convert text from one form of encoding to another. Where -f or --from-code means input encoding and -t or --to-encoding specifies output encoding.
UTF-8 is a multibyte encoding that can represent any Unicode character. ISO 8859-1 is a single-byte encoding that can represent the first 256 Unicode characters. Both encode ASCII exactly the same way.
Going backwards from UTF-8 to ISO-8859-1 will cause "replacement characters" (�) to appear in your text when unsupported characters are found. byte[] utf8 = ... byte[] latin1 = new String(utf8, "UTF-8"). getBytes("ISO-8859-1"); You can exercise more control by using the lower-level Charset APIs.
Could it be that your file is not ISO-8859-15 encoded? You should be able to check with the file command:
file YourFile.txt
Also, you can use iconv without providing the encoding of the original file:
iconv -t UTF-8 YourFile.txt
I found this to work for me:
iconv -f ISO-8859-14 Agreement.txt -t UTF-8 -o agreement.txt
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With