Eliminate non-ascii chars from generated include file

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34815 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Michael Wetherell
2005-07-04 12:25:56 +00:00
parent 76ad7b36c1
commit a7ea35b011
2 changed files with 25 additions and 25 deletions

View File

@@ -39,26 +39,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"') . $_ . '"'
}