Ruby beats Perl for UTF-8 handling

Just had to write a script to do some processing on a tab-delimited file that contained some Hebrew UTF-8 chars, including a json chunk containing some Hebrew. Major headache with Perl – either got ‘wide char in subroutine’ errors, or escaped codes in the JSON. Needed to compare the UTF-8 tab-delimited fields with specific pieces of JSON, and have them both handled as UTF-8. Tried use utf8; binmode(STDIN, ':utf8') and various other permutations, but couldn’t get the output to look the way I wanted while keeping all the subroutines happy.

Implemented the same thing in Ruby, and it just worked. I’ve been a Perl girl for years, but am leaning Ruby…

Leave a Reply