A rant about Ruby 1.9 String encoding
github.com
A rant about Ruby 1.9 String encoding
1–10 of 55 posts
Re: A rant about Ruby 1.9 String encoding
#2Re: A rant about Ruby 1.9 String encoding
#3Re: A rant about Ruby 1.9 String encoding
#4Re: A rant about Ruby 1.9 String encoding
#5This is why most C++ teams prohibit their members to overload operators.
Re: A rant about Ruby 1.9 String encoding
#6Re: A rant about Ruby 1.9 String encoding
#7Re: A rant about Ruby 1.9 String encoding
#8What Ruby 1.9 gets absolutely right is that its String implementation is completely encoding agnostic (by which I specifically mean that it doesn't force your data to be encoded in a particular way). There are encodings for which there is no safe UTF-8 roundtrip (you can successfully convert the data to UTF-8 nicely, but when you convert back to UTF-8 to that encoding, you won't get the original input back; you'll get a slightly different output).
Rubyists in Japan don't have the luxury of dealing with Unicode all the time; they still get lots of data in ShiftJIS and other encodings. (The same is true of Rubyists elsewhere, but since US-ASCII is a proper subset of UTF-8, most folks don't know the difference; Win1252 is a pain in the ass, though.) If you have to do ANY work with older data formats, you curse languages that force you to use UTF-8 all the time instead of letting you work with the native data.
Most developers don't think about i18n nearly enough in any case; there's a lot more to worry about that simply using Unicode doesn't solve for you. Even the developers of Ruby have to worry about the fact that LATIN SMALL LETTER E WITH ACUTE (U+00E9) is the same as LATIN SMALL LETTER E (U+0065) COMBINING ACUTE ACCENT (U+0301); it doesn't begin to address the capitalization of 'ß' ('SS', which isn't necessarily reversible) or that in Turkish 'ı' capitalizes to 'I', but 'i' capitalizes to 'İ'. Don't EVEN get me started on number formatting...
EDIT: Added the last paragraph.
Re: A rant about Ruby 1.9 String encoding
#9It seems the most obvious solution is to store strings in a standard encoding (say UTF-8) and to always convert strings to it at the time of their creation. Is there a technical reason why Ruby doesn't do this?
Loss of text data is bad.
Re: A rant about Ruby 1.9 String encoding
#10It seems like this would be a problem on Python as well, no?