From: Andreas König Date: Thu, 24 Jan 2002 12:45:44 +0000 (+0100) Subject: Very old debugger UTF-8 bug X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f8543d02b547a2763330f0ee30b25144a6fc1218;p=p5sagit%2Fp5-mst-13.2.git Very old debugger UTF-8 bug Message-ID: p4raw-id: //depot/perl@14402 --- diff --git a/lib/dumpvar.pl b/lib/dumpvar.pl index c918f2b..34a9c59 100644 --- a/lib/dumpvar.pl +++ b/lib/dumpvar.pl @@ -44,6 +44,12 @@ sub unctrl { $_; } +sub uniescape { + join("", + map { $_ > 255 ? sprintf("\\x{%04X}", $_) : chr($_) } + unpack("U*", $_[0])); +} + sub stringify { local($_,$noticks) = @_; local($v) ; @@ -67,6 +73,7 @@ sub stringify { } elsif ($unctrl eq 'unctrl') { s/([\"\\])/\\$1/g ; s/([\000-\037\177])/'^'.pack('c',ord($1)^64)/eg; + # uniescape? s/([\200-\377])/'\\0x'.sprintf('%2X',ord($1))/eg if $quoteHighBit; } elsif ($unctrl eq 'quote') { @@ -74,6 +81,7 @@ sub stringify { s/\033/\\e/g; s/([\000-\037\177])/'\\c'.chr(ord($1)^64)/eg; } + $_ = uniescape($_); s/([\200-\377])/'\\'.sprintf('%3o',ord($1))/eg if $quoteHighBit; ($noticks || /^\d+(\.\d*)?\Z/) ? $_