Displaying utf8 text in perl -d
am 14.09.2007 23:57:30 von lbova99Please forgive the cross-post. I asked this question originally
on perl.beginners, because that's what I am. But since I haven't
had any feedback, I thought I'd ask here ...
I work with utf8 non-English text frequently, using perl 5.8.8 on
Solaris-10. I can include the following lines in my code and work
successfully ( I'm writing these from memory, so please forgive my
syntax.):
binmode STDIN, ':utf8';
binmode STDOUT, ':utf8';
binmode STDERR, ':utf8';
use utf8;
This allows my apps to work gracefully with utf8 data. However, when
I use the debugger (perl -d), I have always had some problems.
Basically, I could see the utf8 literals in my code, but anytime I "p"
or "x", the characters above the low ASCII range simply disappeared.
They were still in the variables, which I could tell by counting the
length of strings, but they vanished from the visible output.
Recently, I found a clue to this problem, and now I include the
following in my app:
binmode $DB::OUT, ':utf8';
Eureka! Now the utf8 data is visible when I "p" or "x". This is a
great improvement. However, now the utf8 literals in my code are
mangled. They display with some form of "^_" instead of displaying as
"themselves".
I am a lot better off this way than I used to be, but I'm sure there's
some more magic to be applied to this problem. As a beginner, I spend
a lot of time in the debugger, so a solution would be most helpful.
Thanks,
Lou