@dkf it's far from solved, I'll admit it freely. When Ruby encounters two strings of different encodings being concatenated, it'll raise an exception:
utf8 = 'zażółć gęślą jaźń'
iso = 'zażółć gęślą jaźń'.encode('iso-8859-2')
con = utf8 + iso #=> Encoding::CompatibilityError: incompatible character encodings: UTF-8 and ISO-8859-2
It's much funnier when Ruby doesn't know that the strings are in different encodings - one of the standard library's functions for reading over HTTP will happily assume it's getting UTF-8 when it's not told explicitly (e.g. via a HTTP header) what the server is sending. Then it will of course gladly concatenate strings, operate on them, write them to files... Makes for some fun debugging when it comes up all mangled on your end because the server's UTF-16LE was interpreted as UTF-8.
Similarly to dates, strings are apparently hard.
I was happily chugging along in Ruby and now you're making me remember all the quirks, fuckups and caveats :D
@dkf said in Which language is the least bad?:
I believe that was the day when I used the phrase “fucking shit-kicking dickwads” about the implementors of Ruby.
Truth be told I'd be much happier if they were actually dickwads, but they seem like a nice bunch ;)