diff options
author | Karl Williamson <public@khwilliamson.com> | 2010-12-16 10:38:09 -0700 |
---|---|---|
committer | Karl Williamson <public@khwilliamson.com> | 2010-12-16 10:40:04 -0700 |
commit | ec0363d9bb05a67dad10a50c9b76b5aba365199a (patch) | |
tree | df9cdba141dff210c4433659f6eac0f245887f8a /t | |
parent | 20f15c4187eac900e8420667a1591aa1a78ab45d (diff) | |
download | perl-ec0363d9bb05a67dad10a50c9b76b5aba365199a.tar.gz |
test.pl: extend EBCDIC functions to beyond 255
Allow the functions to handle non-latin1 input. This would only show up
on EBCDIC platforms.
Diffstat (limited to 't')
-rw-r--r-- | t/test.pl | 15 |
1 files changed, 10 insertions, 5 deletions
@@ -1142,16 +1142,21 @@ sub latin1_to_native($) { } sub ord_latin1_to_native { - # given an input latin1 code point, return the platform's native - # equivalent value + # given an input code point, return the platform's native + # equivalent value. Anything above latin1 is itself. - return ord latin1_to_native(chr $_[0]); + my $ord = shift; + return $ord if $ord > 255; + return ord latin1_to_native(chr $ord); } sub ord_native_to_latin1 { - # given an input platform code point, return the latin1 equivalent value + # given an input platform code point, return the latin1 equivalent value. + # Anything above latin1 is itself. - return ord native_to_latin1(chr $_[0]); + my $ord = shift; + return $ord if $ord > 255; + return ord native_to_latin1(chr $ord); } 1; |