Re:OMG Ponies (Aka Humanity: Epic Fail)
by mumrah on Monday November 02, 2009 @09:32PM
(#918439)
It's important to note that choice of language affects a lot of these issues. For example, the unicode issue in Python:
[ Parent
| on HN ]
Nope, Python fucks this up just the same, even in Python 3:
>>> print u'Les Mise\u0301rables'[::-1] #2
>>> print('Les Mise\u0301rables'[::-1]) #3
selbaŕesiM seL
Almost no implementation will fuck up LATIN SMALL LETTER E WITH ACUTE U+00E9, but nearly all programming languages will royally fuck up a COMBINING ACUTE ACCENT U+0301 even in much easier cases like string length. Almost all implementations that claim to be UTF-16 are actually UCS-2, and can't handle surrogates in the slightest.You can get the correct result by normalizing the string first:
>>> import unicodedata
>>> print unicodedata.normalize('NFC', u'Les Mise\u0301rables')[::-1]
selbarésiM seLThat's in some sense even more broken: Not all combined characters have a normalized form, so the result is even less predictable. (I don't have an example ready.)
Here’s a good series of articles on how it works in Ruby: http://blog.grayproductions.net/categories/character_encodin...
Apparently Ruby 1.9 handles it well.
(I wouldn’t be surprised if this had previously been linked on HN.)
I think the s is round the wrong way.
and the grave should be an acute.