Petr Mensik
Petr Mensik

Reputation: 27536

Difference between UTF encodings?

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?

Upvotes: 10

Views: 5961

Answers (2)

Gerald Spreer
Gerald Spreer

Reputation: 413

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.

Upvotes: 3

MutterMumble
MutterMumble

Reputation: 36

Perhaps the Unicode FAQ would help?

There is a comparison chart that summarises some of the differences.

Upvotes: 0

Related Questions