X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/bc10103ec8203b5affe1a16b943049a2f27936bd..c2f8c2b245959f612f0ebac31ab8d80bef6ea9e2:/tests/regex/regex.pl diff --git a/tests/regex/regex.pl b/tests/regex/regex.pl index 2402864171..0586861843 100755 --- a/tests/regex/regex.pl +++ b/tests/regex/regex.pl @@ -3,9 +3,8 @@ # Name: regex.pl # Purpose: Generate test code for wxRegEx from 'reg.test' # Author: Mike Wetherell -# RCS-ID: $Id$ # Copyright: (c) Mike Wetherell -# Licence: wxWidgets licence +# Licence: wxWindows licence ############################################################################# # @@ -39,26 +38,26 @@ sub quotecxx { "\013" => "v", '"' => '"', "\\" => "\\" ); # working around lack of 'use encoding' - $_ = pack "U0C*", unpack "C*", $_; - use utf8; + if (!$utf) { + $_ = pack "U0C*", unpack "C*", $_; + use utf8; + } s/[\000-\037"\\\177-\x{ffff}]/ if ($esc{$&}) { "\\$esc{$&}"; - } elsif (ord($&) > 0x9f) { - if ($utf) { - $&; - } else { - sprintf "\\u%04x", ord($&); - } + } elsif (ord($&) > 0x9f && !$utf) { + sprintf "\\u%04x", ord($&); } else { sprintf "\\%03o", ord($&); } /ge; # working around lack of 'use encoding' - no utf8; - $_ = pack "C*", unpack "C*", $_; + if (!$utf) { + no utf8; + $_ = pack "C*", unpack "C*", $_; + } return ($utf ? '"' : 'L"') . $_ . '"' }