summaryrefslogtreecommitdiff
path: root/lib/Carp
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2005-09-07 11:09:10 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2005-09-07 11:09:10 +0000
commite6ddefa8ea3de4bcc18352257210295203bcb7cb (patch)
treed3436b987d603872a2e13655a9294240c702f169 /lib/Carp
parent36beb999c4b598c099cb2aaa1524a2a45a9a788b (diff)
downloadperl-e6ddefa8ea3de4bcc18352257210295203bcb7cb.tar.gz
The formatting function of Carp::Heavy has problem with utf8 strings.
Work around it. p4raw-id: //depot/perl@25363
Diffstat (limited to 'lib/Carp')
-rw-r--r--lib/Carp/Heavy.pm5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/Carp/Heavy.pm b/lib/Carp/Heavy.pm
index 0180dcfda4..79aa5f8f9b 100644
--- a/lib/Carp/Heavy.pm
+++ b/lib/Carp/Heavy.pm
@@ -116,9 +116,10 @@ sub format_arg {
$arg = "'$arg'" unless $arg =~ /^-?[\d.]+\z/;
# The following handling of "control chars" is direct from
- # the original code - I think it is broken on Unicode though.
+ # the original code - it is broken on Unicode though.
# Suggestions?
- $arg =~ s/([[:cntrl:]]|[[:^ascii:]])/sprintf("\\x{%x}",ord($1))/eg;
+ utf8::is_utf8($arg)
+ or $arg =~ s/([[:cntrl:]]|[[:^ascii:]])/sprintf("\\x{%x}",ord($1))/eg;
return $arg;
}