by ddebernardy · 13y ago · 0 comments
>> "\u0308"
=> "̈"
>> "\u00eb"
=> "ë"
>> "noe\u0308l"
=> "noël"
>> "no\u00ebl"
=> "noël"
His noël examples work just fine if you don't copy/paste the string he posts, and instead type them in like I just did.If anything, languages are reporting correct reverses and length, since he's really manipulating 5 characters rather than four.
2.0.0p247 :045 > Unicode::compose("e\u0308").unpack('U').first.to_s(16)
=> "eb"
2.0.0p247 :046 > Unicode::compose("\u00eb").unpack('U').first.to_s(16)
=> "eb"
2.0.0p247 :047 > Unicode::decompose("e\u0308").unpack('U').first.to_s(16)
=> "65"
2.0.0p247 :048 > Unicode::decompose("\u00eb").unpack('U').first.to_s(16)
=> "65"
I presume the ones you pasted in were changed by the browser. His examples are not wrong at all, indeed how can a string be "wrong"?As for being changed by the browser, the latter (or rather the OS) copied what there was, and the OS pasted it verbatim insofar as I can tell.