Unicode in Perl, FTW (Я очень рад, ведь я, наконец, возвращаюсь домой)

Found on my hard drive. I love that it's source code that's literally in UTF-8 and it all just looks "right" or whatever that Russian says.

use utf8;
use Encode 'encode';
print encode("ascii", 'Я очень рад, ведь я, наконец, возвращаюсь домой', sub{ sprintf "", shift });;

BTW:

3 Comments

russian says "i'm very happy since im returning home"
besides, this thing does not work in my environment (win xp), do you know why? it prints ???? ????, ??? ??

works only if
print encode("utf8" ...etc

Leave a comment

About Josh ben Jore

user-pic I blog about Perl.