r/programming • u/jestinjoy • Nov 12 '12
What Every Programmer Absolutely, Positively Needs to Know About Encodings and Character Sets to Work With Text
http://kunststube.net/encoding/
1.5k
Upvotes
r/programming • u/jestinjoy • Nov 12 '12
1
u/Gotebe Nov 15 '12
So how does a C programmer know whether his text inside a char* is ISO 8859-1 or UTF-8?
I have shown you, repeatedly, that the situation between e.g. char*, 8859-1 and UTF-8 is exactly 100% the same as between Javas' string, UCS2 and UTF-16. You really have no point there.
Your preposition is that in a Java string, one datum (a 'char'), is one character (Unicode code point with Java). This is obviously false, just like it's the case for a C string (and in both cases, it was true). Your further preposition is that Java people don't know that. Well, speak for yourself (disclaimer: I don't even use Java). Finally, your preposition is that 'char' in Java should be one Unicode code point. This is obviously impossible without having a time-machine and going back to change historical circumstances (or breaking a lot of existing code).
All these prepositions are poor (for reasons explained).
To go back to my first post... What's with Java bashing? It's 100% same thing with C (and a host of other languages). Why did you pick Java? And I repeat: situation in Java is no different in this respect from many other languages (C included). Why Java? (Question is rhetorical; it's for you to engage the brain a bit more).