Giovanni Silva
Giovanni Silva

Giovanni Silva

Developers, Use UTF-8 as encoding for the sake of sanity

Giovanni Silva's photo
Giovanni Silva
·Jul 26, 2018·

2 min read

Oh god, pay attention on your editor (eclipse is trolling you most of the time :-). Never... ever... save a file on a different encoding than UTF-8. If you really need that, good luck, on 99.999999999999999% of the cases don't screw this up, for the sake of sanity.

That is good advice for databases, and other systems as well.

Portuguese is my mother language, the character encoding is ISO-8859-1, and you know what? This standard can be throw out of the face of the computer world, is going to be for the best, trust me.

For you that don't use accents (English most) you are better in UTF-8 anyway.

For you that speaks chinese, arabic, or other more exotic (compared to western english), maybe UTF-8 is not as good as it sound's, but still the primary choice. And we are talking about programming code, so...

Why I keep finding projects with files in other encoding is a mystery. Misinformation? Bed editors?

Yes this is just a complaining blog post, I hope it sparks a little point on your memory so you don't make that mistake while programming. Is something we should not have to think of, but know that we will lose precious time and money if we screw this up.

If you get trapped is this trap, iconv is your friend.

 iconv -f old-encoding -t new-encoding file.txt > newfile.txt

Best wishes.

Giovanni Silva

Share this