62 points · by lelf · 12y ago · 16 comments
http://stackoverflow.com/questions/6162484/why-does-modern-p...
http://dheeb.files.wordpress.com/2011/07/gbu.pdf
(The official URL is: http://training.perl.com/OSCON2011/index.html but it's currently timing out for me)
It do feel like getting information on the construction method of the whips which will be used on your back sometime in the future. :-) :-(
And the first comment (which i did go through for my ventures into perl unicode) is nothing but prove how broken it is. So maybe you are just being sarcastic and i didn't get it.. ;)
First of all you don't NEED most of the stuff shown there. The boilerplate at the bottom is there to cover EVERY POSSIBLE THING anyone would possibly ever want to do with unicode in Perl and because tchrist thinks it's funny to do such things. If all you want is to read a unicode file, change its contents, then write it back to hdd without breaking encoding, you don't need more than:
use utf8;
use IO::All -utf8;
Secondly, all other languages do it worse than Perl 5.[citation needed]
Jokes aside :) if you look at the 2011 OSCon presentation pdf, you'll see it's vastly outdated (and imho the default internal encoding table is just imprecise)
OTOH I don't use unicode regexps very often, so my POV is biased (I'm sure that on this front perl5 can actually be better than virtually everything else)
For a rather complex multithreaded client/server program that reads and writes difference sources (http, webdav, ldap, file, terminal) with a lot of dependencies it really was a nightmare, trust me. Maybe i didn't get some obvious global "do that unicode stuff right" switch and i am just too dumb. But even then, i've never had such problems in _any_ other language.
Interestingly i did need to write a very similar tool one year later in python and i had much less problems. And that was python 2.x which is always said to have bad unicode support. Maybe it's just because in python (afaik) you only have to take care of some str() or unicode() semantics and not about a gazillion of use statements, open() parameters and whatnot.
Maybe Perl5 has perfect unicode support but how to use and achieve that is a freaking nightmare in a non-trivial program.
* How do you compare strings in Ruby so that an "o with umlaut" as a single character can be compared against a "o" + "umlaut" characters. Technically they are both equivalent, but if you're doing comparisons by single characters (or bytes!), then you'll run into issues.
* How do you use a regular expression in Python to match against o and "o with umlaut" as equivalent?
Yes I know I'll be downvoted to zero karma.