OK, so I wrote Devel::Unicode a while back to help with debugging Unicode output. The idea is to run a script using:

perl -d:Unicode myscript.pl

... and any characters which are not ASCII printable characters or whitespace will be replaced by visible \x{NNNN} escape codes.

I recently hit upon a Unicode problem in a Perl test script. Unfortunately Test::Builder plays funny games with STDOUT, so Devel::Unicode can't play nice with it. Easy solution:

perl t/04utf8.t |& perl -d:Unicode -pe1

(The |& bit is C shell syntax for piping both STDERR and STDOUT, because much of what I was inspecting was printed to STDERR. Bash users may be more familiar with 2&>1|.)

Awesomely, this also works for non-Perl programs, so if you're having trouble generating UTF-8 output in, say, Python, it should just be a matter of:

python myscript.py | perl -d:Unicode -pe1
perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'

Replies are listed 'Best First'.