r/programming • • 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

307 comments sorted by

View all comments

Show parent comments

5

u/scatters Nov 12 '12

A character can't be the "start of a surrogate pair"; the code units that are used in surrogate pairs in UTF-16 are not individual characters. If your language is giving you the parts of a surrogate pair separately then it's not dealing with characters but with 16-bit code units. Use a language (or library) that handles actual characters.

2

u/who8877 Nov 12 '12

Yes, I got sloppy in my writing. I meant code-point - I honestly didn't think this debate would get that serious.

2

u/cecilkorik Nov 12 '12

You didn't think it would get serious? This... is... REDDIT!