- chr()
-
chr() must be given an EBCDIC code number argument to yield a desired character return
value on an EBCDIC machine. For example:
$CAPITAL_LETTER_A = chr(193);
|
|
- ord()
-
ord() will return EBCDIC code number values on an EBCDIC machine. For example:
$the_number_193 = ord("A");
|
|
- pack()
-
The c and C templates for pack() are dependent upon character set encoding. Examples of
usage on EBCDIC include:
$foo = pack("CCCC",193,194,195,196);
# $foo eq "ABCD"
$foo = pack("C4",193,194,195,196);
# same thing
$foo = pack("ccxxcc",193,194,195,196);
# $foo eq "AB\0\0CD"
|
|
- print()
-
One must be careful with scalars and strings that are passed to print that contain
ASCII encodings. One common place for this to occur is in the output of the MIME type
header for CGI script writing. For example, many perl programming guides recommend
something similar to:
print "Content-type:\ttext/html\015\012\015\012";
# this may be wrong on EBCDIC
|
|
Under the IBM OS/390 USS Web Server or WebSphere on z/OS for example you should instead
write that as:
print "Content-type:\ttext/html\r\n\r\n"; # OK for DGW et alia
|
|
That is because the translation from EBCDIC to ASCII is done by the web server in this
case (such code will not be appropriate for the Macintosh however). Consult your web
server's documentation for further details.
- printf()
-
The formats that can convert characters to numbers and vice versa will be different
from their ASCII counterparts when executed on an EBCDIC machine. Examples include:
printf("%c%c%c",193,194,195); # prints ABC
|
|
- sort()
- EBCDIC sort results may differ from ASCII sort results especially for mixed case
strings. This is discussed in more detail below.
- sprintf()
-
See the discussion of printf() above. An example of the use of sprintf would be:
$CAPITAL_LETTER_A = sprintf("%c",193);
|
|
- unpack()
- See the discussion of pack() above.
|
|