From 9ce2357ee574b9377c898a552cb981a078f1722d Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Sat, 27 Nov 2010 20:51:54 -0700 Subject: [PATCH] regcomp.c: Use hex instead of octal for debug ords The ordinals that are output in the debugging output have been in octal, which is ok for the low controls, but for above Latin1, the standard is hex, so this changes them all to correspond. If desired the low controls could be changed back to be in octal. --- regcomp.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/regcomp.c b/regcomp.c index 72afd06..9c013af 100644 --- a/regcomp.c +++ b/regcomp.c @@ -10365,8 +10365,14 @@ S_put_byte(pTHX_ SV *sv, int c) ones (binary 1111 1111, hexadecimal FF). It is similar, but not identical, to the ASCII delete (DEL) or rubout control character. ) So the old condition can be simplified to !isPRINT(c) */ - if (!isPRINT(c)) - Perl_sv_catpvf(aTHX_ sv, "\\%o", c); + if (!isPRINT(c)) { + if (c < 256) { + Perl_sv_catpvf(aTHX_ sv, "\\x%02x", c); + } + else { + Perl_sv_catpvf(aTHX_ sv, "\\x{%x}", c); + } + } else { const char string = c; if (c == '-' || c == ']' || c == '\\' || c == '^') -- 2.7.4