summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorNick Ing-Simmons <nik@tiuk.ti.com>2000-10-08 13:16:33 +0000
committerNick Ing-Simmons <nik@tiuk.ti.com>2000-10-08 13:16:33 +0000
commit5dcbab342366e23215fe343c50f656558418f409 (patch)
tree37a45dc447afa04fb5ad1df728fc66aeb1e277e0 /ext
parent5345d506e0f862025d90da43f18289aba83efacd (diff)
downloadperl-5dcbab342366e23215fe343c50f656558418f409.tar.gz
Tables assume network byte order for 16 bit forms, so 'S' packing
is not right thing to do on (e.g. x86). Network order is also "right" for X fonts. p4raw-id: //depot/perl@7168
Diffstat (limited to 'ext')
-rw-r--r--ext/Encode/Encode.pm8
1 files changed, 4 insertions, 4 deletions
diff --git a/ext/Encode/Encode.pm b/ext/Encode/Encode.pm
index 9d5e07f339..8ba7232d5e 100644
--- a/ext/Encode/Encode.pm
+++ b/ext/Encode/Encode.pm
@@ -469,9 +469,9 @@ sub name { shift->{'Name'} }
sub rep_S { 'C' }
-sub rep_D { 'S' }
+sub rep_D { 'n' }
-sub rep_M { ($_[0] > 255) ? 'S' : 'C' }
+sub rep_M { ($_[0] > 255) ? 'n' : 'C' }
sub representation
{
@@ -542,7 +542,7 @@ sub toUnicode
my $uni = '';
while (length($str))
{
- my $code = unpack('S',substr($str,0,2,''));
+ my $code = unpack('n',substr($str,0,2,'')) & 0xffff;
$uni .= chr($code);
}
$_[1] = $str if $chk;
@@ -562,7 +562,7 @@ sub fromUnicode
last if ($chk);
$x = 0;
}
- $str .= pack('S',$x);
+ $str .= pack('n',$x);
}
$_[1] = $uni if $chk;
return $str;