5 ms·
Congratulations, you've discovered unicode composition! 2.0.0p247 :045 > Unicode::compose("e\u0308").unpack('U').first.to_s(16) => "eb" 2.0.0p247 :046
by enko 13y ago
Congratulations, you've discovered unicode composition!
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"?
- ddebernardy 13y agoHis example is "wrong" in the sense that you cannot reasonably complain that "noe¨l" gets reversed to "l¨eon" and put the "¨" part on top of the "l" when it does — which seems entirely correct. Or for that matter, that the string's length is 5 when there are indeed 5 characters. 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.