From: Jarkko Hietaniemi Date: Sat, 5 Apr 2003 20:38:30 +0000 (+0000) Subject: [perl #21839] perluniintro.pod: nice_string() doesn't escape X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d0551e7362dcfdf0d37c8900b7c6372851ee7f19;p=p5sagit%2Fp5-mst-13.2.git [perl #21839] perluniintro.pod: nice_string() doesn't escape literal escape chars -- use Sadahiro-san's fix(es). p4raw-id: //depot/perl@19148 --- diff --git a/pod/perluniintro.pod b/pod/perluniintro.pod index f18cdee..feee902 100644 --- a/pod/perluniintro.pod +++ b/pod/perluniintro.pod @@ -451,7 +451,7 @@ displayed as C<\x..>, and the rest of the characters as themselves: sprintf("\\x{%04X}", $_) : # \x{...} chr($_) =~ /[[:cntrl:]]/ ? # else if control character ... sprintf("\\x%02X", $_) : # \x.. - chr($_) # else as themselves + quotemeta(chr($_)) # else quoted or as themselves } unpack("U*", $_[0])); # unpack Unicode characters } @@ -459,9 +459,11 @@ For example, nice_string("foo\x{100}bar\n") -returns: +returns the string - "foo\x{0100}bar\x0A" + 'foo\x{0100}bar\x0A' + +which is ready to be printed. =head2 Special Cases