X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=ext%2FEncode%2Fcompile;h=d0611f719f2639529084ba4c83d24073771bbd69;hb=0a1f2d144e4463451f8627bd1c6ca420a59b01b0;hp=5e3e645502a2d58486de5f066816a8c914b8a1a8;hpb=f39fb8cc9d88ca007aab35d5a7373417b639dd74;p=p5sagit%2Fp5-mst-13.2.git diff --git a/ext/Encode/compile b/ext/Encode/compile index 5e3e645..d0611f7 100755 --- a/ext/Encode/compile +++ b/ext/Encode/compile @@ -8,23 +8,16 @@ use Getopt::Std; my @orig_ARGV = @ARGV; my $perforce = '$Id$'; - sub encode_U { # UTF-8 encode long hand - only covers part of perl's range my $uv = shift; - if ($uv < 0x80) - { - return chr($uv) - } - if ($uv < 0x800) - { - return chr(($uv >> 6) | 0xC0). - chr(($uv & 0x3F) | 0x80); - } - return chr(($uv >> 12) | 0xE0). - chr((($uv >> 6) & 0x3F) | 0x80). - chr(($uv & 0x3F) | 0x80); + # chr() works in native space so convert value from table + # into that space before using chr(). + my $ch = chr(utf8::unicode_to_native($uv)); + # Now get core perl to encode that the way it likes. + utf8::encode($ch); + return $ch; } sub encode_S @@ -143,7 +136,7 @@ sub cmp_name foreach my $enc (sort cmp_name @encfiles) { my ($name,$sfx) = $enc =~ /^.*?([\w-]+)\.(enc|ucm)$/; - $name = delete $opt{'n'} if exists $opt{'n'}; + $name = $opt{'n'} if exists $opt{'n'}; if (open(E,$enc)) { if ($sfx eq 'enc') @@ -241,7 +234,7 @@ sub compile_ucm } else { - # $name = lc($cs); + $name = $cs unless exists $opt{'n'}; } my $erep; my $urep;