Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between UTF encodings?

Tags:

encoding

utf

I have a simple question - what is the difference between UTF-8, UTF-16 and UTF-32? I know that encoded strings have different sizes, but what is the UTF-16 and UTF-32 for?Should't UTF-8 be able to handle all languages correctly? And how does UTF-7 fit into this?

EDIT

Ok, I relatively understand the technical side of the whole thing, but I still don't see a reason why I should use for example UTF-16 instead of UTF-8 in my app. So my question is - what is the practical usage of other encodings then UTF-8?

like image 340
Petr Mensik Avatar asked Jun 10 '12 17:06

Petr Mensik


1 Answers

This article by the famous Joel Spolsky explains it perfctly: http://www.joelonsoftware.com/articles/Unicode.html

Quote:

There are hundreds of traditional encodings which can only store some code points correctly and change all the other code points into question marks. Some popular encodings of English text are Windows-1252 (the Windows 9x standard for Western European languages) and ISO-8859-1, aka Latin-1 (also useful for any Western European language). But try to store Russian or Hebrew letters in these encodings and you get a bunch of question marks. UTF 7, 8, 16, and 32 all have the nice property of being able to store any code point correctly.

like image 153
Gerald Spreer Avatar answered Oct 12 '22 15:10

Gerald Spreer