From eaf8b9b98833fdf6fbaeb5e85873f2c3b2783fcb Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Sun, 20 May 2012 15:47:32 -0600 Subject: [PATCH] perlebcdic: remove trailing white space --- pod/perlebcdic.pod | 334 ++++++++++++++++++++++++++--------------------------- 1 file changed, 167 insertions(+), 167 deletions(-) diff --git a/pod/perlebcdic.pod b/pod/perlebcdic.pod index ecd0676..bad5792 100644 --- a/pod/perlebcdic.pod +++ b/pod/perlebcdic.pod @@ -7,7 +7,7 @@ perlebcdic - Considerations for running Perl on EBCDIC platforms =head1 DESCRIPTION An exploration of some of the issues facing Perl programmers -on EBCDIC based computers. We do not cover localization, +on EBCDIC based computers. We do not cover localization, internationalization, or multi-byte character set issues other than some discussion of UTF-8 and UTF-EBCDIC. @@ -23,16 +23,16 @@ by sending mail to perlbug@perl.org The American Standard Code for Information Interchange (ASCII or US-ASCII) is a set of -integers running from 0 to 127 (decimal) that imply character -interpretation by the display and other systems of computers. -The range 0..127 can be covered by setting the bits in a 7-bit binary -digit, hence the set is sometimes referred to as "7-bit ASCII". -ASCII was described by the American National Standards Institute -document ANSI X3.4-1986. It was also described by ISO 646:1991 -(with localization for currency symbols). The full ASCII set is -given in the table below as the first 128 elements. Languages that -can be written adequately with the characters in ASCII include -English, Hawaiian, Indonesian, Swahili and some Native American +integers running from 0 to 127 (decimal) that imply character +interpretation by the display and other systems of computers. +The range 0..127 can be covered by setting the bits in a 7-bit binary +digit, hence the set is sometimes referred to as "7-bit ASCII". +ASCII was described by the American National Standards Institute +document ANSI X3.4-1986. It was also described by ISO 646:1991 +(with localization for currency symbols). The full ASCII set is +given in the table below as the first 128 elements. Languages that +can be written adequately with the characters in ASCII include +English, Hawaiian, Indonesian, Swahili and some Native American languages. There are many character sets that extend the range of integers @@ -41,28 +41,28 @@ One common one is the ISO 8859-1 character set. =head2 ISO 8859 -The ISO 8859-$n are a collection of character code sets from the -International Organization for Standardization (ISO) each of which -adds characters to the ASCII set that are typically found in European +The ISO 8859-$n are a collection of character code sets from the +International Organization for Standardization (ISO) each of which +adds characters to the ASCII set that are typically found in European languages many of which are based on the Roman, or Latin, alphabet. =head2 Latin 1 (ISO 8859-1) -A particular 8-bit extension to ASCII that includes grave and acute -accented Latin characters. Languages that can employ ISO 8859-1 -include all the languages covered by ASCII as well as Afrikaans, -Albanian, Basque, Catalan, Danish, Faroese, Finnish, Norwegian, -Portuguese, Spanish, and Swedish. Dutch is covered albeit without -the ij ligature. French is covered too but without the oe ligature. +A particular 8-bit extension to ASCII that includes grave and acute +accented Latin characters. Languages that can employ ISO 8859-1 +include all the languages covered by ASCII as well as Afrikaans, +Albanian, Basque, Catalan, Danish, Faroese, Finnish, Norwegian, +Portuguese, Spanish, and Swedish. Dutch is covered albeit without +the ij ligature. French is covered too but without the oe ligature. German can use ISO 8859-1 but must do so without German-style -quotation marks. This set is based on Western European extensions +quotation marks. This set is based on Western European extensions to ASCII and is commonly encountered in world wide web work. In IBM character code set identification terminology ISO 8859-1 is also known as CCSID 819 (or sometimes 0819 or even 00819). =head2 EBCDIC -The Extended Binary Coded Decimal Interchange Code refers to a +The Extended Binary Coded Decimal Interchange Code refers to a large collection of single- and multi-byte coded character sets that are different from ASCII or ISO 8859-1 and are all slightly different from each other; they typically run on host computers. The EBCDIC encodings derive from @@ -71,7 +71,7 @@ cards was such that high bits were set for the upper and lower case alphabet characters [a-z] and [A-Z], but there were gaps within each Latin alphabet range. -Some IBM EBCDIC character sets may be known by character code set +Some IBM EBCDIC character sets may be known by character code set identification numbers (CCSID numbers) or code page numbers. Perl can be compiled on platforms that run any of three commonly used EBCDIC @@ -83,7 +83,7 @@ Among IBM EBCDIC character code sets there are 13 characters that are often mapped to different integer values. Those characters are known as the 13 "variant" characters and are: - \ [ ] { } ^ ~ ! # | $ @ ` + \ [ ] { } ^ ~ ! # | $ @ ` When Perl is compiled for a platform, it looks at some of these characters to guess which EBCDIC character set the platform uses, and adapts itself @@ -94,17 +94,17 @@ They are: =head2 0037 -Character code set ID 0037 is a mapping of the ASCII plus Latin-1 -characters (i.e. ISO 8859-1) to an EBCDIC set. 0037 is used -in North American English locales on the OS/400 operating system -that runs on AS/400 computers. CCSID 0037 differs from ISO 8859-1 +Character code set ID 0037 is a mapping of the ASCII plus Latin-1 +characters (i.e. ISO 8859-1) to an EBCDIC set. 0037 is used +in North American English locales on the OS/400 operating system +that runs on AS/400 computers. CCSID 0037 differs from ISO 8859-1 in 237 places, in other words they agree on only 19 code point values. =head2 1047 -Character code set ID 1047 is also a mapping of the ASCII plus -Latin-1 characters (i.e. ISO 8859-1) to an EBCDIC set. 1047 is -used under Unix System Services for OS/390 or z/OS, and OpenEdition +Character code set ID 1047 is also a mapping of the ASCII plus +Latin-1 characters (i.e. ISO 8859-1) to an EBCDIC set. 1047 is +used under Unix System Services for OS/390 or z/OS, and OpenEdition for VM/ESA. CCSID 1047 differs from CCSID 0037 in eight places. =head2 POSIX-BC @@ -218,7 +218,7 @@ you to use different encodings per IO channel. For example you may use to get four files containing "Hello World!\n" in ASCII, CP 0037 EBCDIC, ISO 8859-1 (Latin-1) (in this example identical to ASCII since only ASCII -characters were printed), and +characters were printed), and UTF-EBCDIC (in this example identical to normal EBCDIC since only characters that don't differ between EBCDIC and UTF-EBCDIC were printed). See the documentation of Encode::PerlIO for details. @@ -230,21 +230,21 @@ ignores things like the type of your filesystem (ASCII or EBCDIC). The following tables list the ASCII and Latin 1 ordered sets including the subsets: C0 controls (0..31), ASCII graphics (32..7e), delete (7f), -C1 controls (80..9f), and Latin-1 (a.k.a. ISO 8859-1) (a0..ff). In the -table non-printing control character names as well as the Latin 1 -extensions to ASCII have been labelled with character names roughly -corresponding to I albeit with -substitutions such as s/LATIN// and s/VULGAR// in all cases, -s/CAPITAL LETTER// in some cases, and s/SMALL LETTER ([A-Z])/\l$1/ -in some other cases. The "names" of the controls listed here are +C1 controls (80..9f), and Latin-1 (a.k.a. ISO 8859-1) (a0..ff). In the +table non-printing control character names as well as the Latin 1 +extensions to ASCII have been labelled with character names roughly +corresponding to I albeit with +substitutions such as s/LATIN// and s/VULGAR// in all cases, +s/CAPITAL LETTER// in some cases, and s/SMALL LETTER ([A-Z])/\l$1/ +in some other cases. The "names" of the controls listed here are the Unicode Version 1 names, except for the few that don't have names, in which case the names in the Wikipedia article were used (L). -The differences between the 0037 and 1047 sets are -flagged with ***. The differences between the 1047 and POSIX-BC sets -are flagged with ###. All ord() numbers listed are decimal. If you -would rather see this table listing octal values then run the table -(that is, the pod version of this document since this recipe may not +The differences between the 0037 and 1047 sets are +flagged with ***. The differences between the 1047 and POSIX-BC sets +are flagged with ###. All ord() numbers listed are decimal. If you +would rather see this table listing octal values then run the table +(that is, the pod version of this document since this recipe may not work with a pod2_other_format translation) through: =over 4 @@ -331,16 +331,16 @@ Or, in order to retain the UTF-x code points in hexadecimal: ISO 8859-1 CCSID CCSID CCSID 1047 chr CCSID 0819 0037 1047 POSIX-BC UTF-8 UTF-EBCDIC ---------------------------------------------------------------------------------------------- - 0 0 0 0 0 0 + 0 0 0 0 0 0 1 1 1 1 1 1 2 2 2 2 2 2 3 3 3 3 3 3 - 4 55 55 55 4 55 - 5 45 45 45 5 45 - 6 46 46 46 6 46 - 7 47 47 47 7 47 - 8 22 22 22 8 22 - 9 5 5 5 9 5 + 4 55 55 55 4 55 + 5 45 45 45 5 45 + 6 46 46 46 6 46 + 7 47 47 47 7 47 + 8 22 22 22 8 22 + 9 5 5 5 9 5 10 37 21 21 10 21 *** 11 11 11 11 11 11
12 12 12 12 12 12 @@ -423,7 +423,7 @@ Or, in order to retain the UTF-x code points in hexadecimal: Y 89 232 232 232 89 232 Z 90 233 233 233 90 233 [ 91 186 173 187 91 173 *** ### - \ 92 224 224 188 92 224 ### + \ 92 224 224 188 92 224 ### ] 93 187 189 189 93 189 *** ^ 94 176 95 106 94 95 *** ### _ 95 109 109 109 95 109 @@ -639,8 +639,8 @@ If you would rather see it in POSIX-BC order then change the number =head1 IDENTIFYING CHARACTER CODE SETS -To determine the character set you are running under from perl one -could use the return value of ord() or chr() to test one or more +To determine the character set you are running under from perl one +could use the return value of ord() or chr() to test one or more character values. For example: $is_ascii = "A" eq chr(65); @@ -671,12 +671,12 @@ However, it would be unwise to write tests such as: $is_ascii = "\n" ne chr(10); # ILL ADVISED Obviously the first of these will fail to distinguish most ASCII platforms -from either a CCSID 0037, a 1047, or a POSIX-BC EBCDIC platform since "\r" eq -chr(13) under all of those coded character sets. But note too that -because "\n" is chr(13) and "\r" is chr(10) on the Macintosh (which is an +from either a CCSID 0037, a 1047, or a POSIX-BC EBCDIC platform since "\r" eq +chr(13) under all of those coded character sets. But note too that +because "\n" is chr(13) and "\r" is chr(10) on the Macintosh (which is an ASCII platform) the second C<$is_ascii> test will lead to trouble there. -To determine whether or not perl was built under an EBCDIC +To determine whether or not perl was built under an EBCDIC code page you can use the Config module like so: use Config; @@ -686,18 +686,18 @@ code page you can use the Config module like so: =head2 tr/// -In order to convert a string of characters from one character set to +In order to convert a string of characters from one character set to another a simple list of numbers, such as in the right columns in the -above table, along with perl's tr/// operator is all that is needed. +above table, along with perl's tr/// operator is all that is needed. The data in the table are in ASCII/Latin1 order, hence the EBCDIC columns -provide easy-to-use ASCII/Latin1 to EBCDIC operations that are also easily +provide easy-to-use ASCII/Latin1 to EBCDIC operations that are also easily reversed. For example, to convert ASCII/Latin1 to code page 037 take the output of the second numbers column from the output of recipe 2 (modified to add '\' characters) and use it in tr/// like so: - $cp_037 = + $cp_037 = '\x00\x01\x02\x03\x37\x2D\x2E\x2F\x16\x05\x25\x0B\x0C\x0D\x0E\x0F' . '\x10\x11\x12\x13\x3C\x3D\x32\x26\x18\x19\x3F\x27\x1C\x1D\x1E\x1F' . '\x40\x5A\x7F\x7B\x5B\x6C\x50\x7D\x4D\x5D\x5C\x4E\x6B\x60\x4B\x61' . @@ -739,7 +739,7 @@ XPG operability often implies the presence of an I utility available from the shell or from the C library. Consult your system's documentation for information on iconv. -On OS/390 or z/OS see the iconv(1) manpage. One way to invoke the iconv +On OS/390 or z/OS see the iconv(1) manpage. One way to invoke the iconv shell utility from within perl would be to: # OS/390 or z/OS example @@ -758,7 +758,7 @@ The OS/390 and z/OS C run-time libraries provide _atoe() and _etoa() functions. =head1 OPERATOR DIFFERENCES -The C<..> range operator treats certain character ranges with +The C<..> range operator treats certain character ranges with care on EBCDIC platforms. For example the following array will have twenty six elements on either an EBCDIC platform or an ASCII platform: @@ -766,13 +766,13 @@ or an ASCII platform: @alphabet = ('A'..'Z'); # $#alphabet == 25 The bitwise operators such as & ^ | may return different results -when operating on string or character data in a perl program running +when operating on string or character data in a perl program running on an EBCDIC platform than when run on an ASCII platform. Here is an example adapted from the one in L: # EBCDIC-based examples print "j p \n" ^ " a h"; # prints "JAPH\n" - print "JA" | " ph\n"; # prints "japh\n" + print "JA" | " ph\n"; # prints "japh\n" print "JAPH\nJunk" & "\277\277\277\277\277"; # prints "japh\n"; print 'p N$' ^ " E to chr(0) and C<\cA> to chr(1), etc. as well, but the thirty three characters that result depend on which code page you are using. The table below uses the standard acronyms for the controls. The POSIX-BC and 1047 sets are -identical throughout this range and differ from the 0037 set at only +identical throughout this range and differ from the 0037 set at only one spot (21 decimal). Note that the C character -may be generated by C<\cJ> on ASCII platforms but by C<\cU> on 1047 or POSIX-BC -platforms and cannot be generated as a C<"\c.letter."> control character on +may be generated by C<\cJ> on ASCII platforms but by C<\cU> on 1047 or POSIX-BC +platforms and cannot be generated as a C<"\c.letter."> control character on 0037 platforms. Note also that C<\c\> cannot be the final element in a string or regex, as it will absorb the terminator. But C<\c\I> is a C concatenated with I for all I. - chr ord 8859-1 0037 1047 && POSIX-BC + chr ord 8859-1 0037 1047 && POSIX-BC ----------------------------------------------------------------------- - \c? 127 " " + \c? 127 " " \c@ 0 - \cA 1 + \cA 1 \cB 2 \cC 3 - \cD 4 - \cE 5 - \cF 6 - \cG 7 - \cH 8 - \cI 9 - \cJ 10 + \cD 4 + \cE 5 + \cF 6 + \cG 7 + \cH 8 + \cI 9 + \cJ 10 \cK 11 - \cL 12 - \cM 13 + \cL 12 + \cM 13 \cN 14 \cO 15 - \cP 16 + \cP 16 \cQ 17 \cR 18 - \cS 19 - \cT 20 + \cS 19 + \cT 20 \cU 21 *** \cV 22 - \cW 23 + \cW 23 \cX 24 \cY 25 - \cZ 26 - \c[ 27 + \cZ 26 + \c[ 27 \c\X 28 X X X \c] 29 \c^ 30 @@ -834,7 +834,7 @@ SEPARATOR> concatenated with I for all I. =item chr() -chr() must be given an EBCDIC code number argument to yield a desired +chr() must be given an EBCDIC code number argument to yield a desired character return value on an EBCDIC platform. For example: $CAPITAL_LETTER_A = chr(193); @@ -848,7 +848,7 @@ For example: =item pack() -The c and C templates for pack() are dependent upon character set +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); @@ -864,20 +864,20 @@ encoding. Examples of usage on EBCDIC include: 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 +CGI script writing. For example, many perl programming guides recommend something similar to: - print "Content-type:\ttext/html\015\012\015\012"; + 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 +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 al 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 +the Macintosh however). Consult your web server's documentation for further details. =item printf() @@ -890,7 +890,7 @@ on an EBCDIC platform. Examples include: =item sort() -EBCDIC sort results may differ from ASCII sort results especially for +EBCDIC sort results may differ from ASCII sort results especially for mixed case strings. This is discussed in more detail below. =item sprintf() @@ -908,19 +908,19 @@ See the discussion of pack() above. =head1 REGULAR EXPRESSION DIFFERENCES -As of perl 5.005_03 the letter range regular expressions such as -[A-Z] and [a-z] have been especially coded to not pick up gap -characters. For example, characters such as E C -that lie between I and J would not be matched by the +As of perl 5.005_03 the letter range regular expressions such as +[A-Z] and [a-z] have been especially coded to not pick up gap +characters. For example, characters such as E C +that lie between I and J would not be matched by the regular expression range C. This works in the other direction, too, if either of the range end points is explicitly numeric: C<[\x89-\x91]> will match C<\x8e>, even though C<\x89> is C and C<\x91 > is C, and C<\x8e> is a gap character from the alphabetic viewpoint. -If you do want to match the alphabet gap characters in a single octet -regular expression try matching the hex or octal code such -as C on EBCDIC or C on ASCII platforms to +If you do want to match the alphabet gap characters in a single octet +regular expression try matching the hex or octal code such +as C on EBCDIC or C on ASCII platforms to have your regular expression match C. Another construct to be wary of is the inappropriate use of hex or @@ -953,8 +953,8 @@ set of subs: } The above would be adequate if the concern was only with numeric code points. -However, the concern may be with characters rather than code points -and on an EBCDIC platform it may be desirable for constructs such as +However, the concern may be with characters rather than code points +and on an EBCDIC platform it may be desirable for constructs such as C to print out the expected message. One way to represent the above collection of character classification subs that is capable of working across the @@ -964,7 +964,7 @@ four coded character sets discussed in this document is as follows: my $char = substr(shift,0,1); if (ord('^')==94) { # ascii return $char =~ /[\000-\037]/; - } + } if (ord('^')==176) { # 0037 return $char =~ /[\000-\003\067\055-\057\026\005\045\013-\023\074\075\062\046\030\031\077\047\034-\037]/; } @@ -1000,7 +1000,7 @@ four coded character sets discussed in this document is as follows: return $char =~ /[\040-\045\006\027\050-\054\011\012\033\060\061\032\063-\066\010\070-\073\040\024\076\377]/; } if (ord('^')==106) { # posix-bc - return $char =~ + return $char =~ /[\040-\045\006\027\050-\054\011\012\033\060\061\032\063-\066\010\070-\073\040\024\076\137]/; } } @@ -1011,21 +1011,21 @@ four coded character sets discussed in this document is as follows: return $char =~ /[\240-\377]/; } if (ord('^')==176) { # 0037 - return $char =~ + return $char =~ /[\101\252\112\261\237\262\152\265\275\264\232\212\137\312\257\274\220\217\352\372\276\240\266\263\235\332\233\213\267\270\271\253\144\145\142\146\143\147\236\150\164\161-\163\170\165-\167\254\151\355\356\353\357\354\277\200\375\376\373\374\255\256\131\104\105\102\106\103\107\234\110\124\121-\123\130\125-\127\214\111\315\316\313\317\314\341\160\335\336\333\334\215\216\337]/; } if (ord('^')==95) { # 1047 return $char =~ - /[\101\252\112\261\237\262\152\265\273\264\232\212\260\312\257\274\220\217\352\372\276\240\266\263\235\332\233\213\267\270\271\253\144\145\142\146\143\147\236\150\164\161-\163\170\165-\167\254\151\355\356\353\357\354\277\200\375\376\373\374\272\256\131\104\105\102\106\103\107\234\110\124\121-\123\130\125-\127\214\111\315\316\313\317\314\341\160\335\336\333\334\215\216\337]/; + /[\101\252\112\261\237\262\152\265\273\264\232\212\260\312\257\274\220\217\352\372\276\240\266\263\235\332\233\213\267\270\271\253\144\145\142\146\143\147\236\150\164\161-\163\170\165-\167\254\151\355\356\353\357\354\277\200\375\376\373\374\272\256\131\104\105\102\106\103\107\234\110\124\121-\123\130\125-\127\214\111\315\316\313\317\314\341\160\335\336\333\334\215\216\337]/; } if (ord('^')==106) { # posix-bc - return $char =~ + return $char =~ /[\101\252\260\261\237\262\320\265\171\264\232\212\272\312\257\241\220\217\352\372\276\240\266\263\235\332\233\213\267\270\271\253\144\145\142\146\143\147\236\150\164\161-\163\170\165-\167\254\151\355\356\353\357\354\277\200\340\376\335\374\255\256\131\104\105\102\106\103\107\234\110\124\121-\123\130\125-\127\214\111\315\316\313\317\314\341\160\300\336\333\334\215\216\337]/; } } -Note however that only the C sub is really independent -of coded character set. Another way to write C would be +Note however that only the C sub is really independent +of coded character set. Another way to write C would be to use the characters in the range explicitly: sub Is_latin_1 { @@ -1033,7 +1033,7 @@ to use the characters in the range explicitly: $char =~ /[ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ]/; } -Although that form may run into trouble in network transit (due to the +Although that form may run into trouble in network transit (due to the presence of 8 bit characters) or on non ISO-Latin character sets. =head1 SOCKETS @@ -1057,12 +1057,12 @@ abbreviation for drive; that is: The property of lowercase before uppercase letters in EBCDIC is even carried to the Latin 1 EBCDIC pages such as 0037 and 1047. -An example would be that E C (203) comes -before E C (235) on an ASCII platform, but -the latter (83) comes before the former (115) on an EBCDIC platform. -(Astute readers will note that the uppercase version of E -C is simply "SS" and that the upper case version of -E C is not in the 0..255 range but it is +An example would be that E C (203) comes +before E C (235) on an ASCII platform, but +the latter (83) comes before the former (115) on an EBCDIC platform. +(Astute readers will note that the uppercase version of E +C is simply "SS" and that the upper case version of +E C is not in the 0..255 range but it is at U+x0178 in Unicode, or C<"\x{178}"> in a Unicode enabled Perl). The sort order will cause differences between results obtained on @@ -1081,21 +1081,21 @@ C towards the character set case most employed within the data. If the data are primarily UPPERCASE non Latin 1 then apply tr/[a-z]/[A-Z]/ then sort(). If the data are primarily lowercase non Latin 1 then apply tr/[A-Z]/[a-z]/ before sorting. If the data are primarily UPPERCASE -and include Latin-1 characters then apply: +and include Latin-1 characters then apply: tr/[a-z]/[A-Z]/; tr/[àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþ]/[ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞ/; s/ß/SS/g; -then sort(). Do note however that such Latin-1 manipulation does not -address the E C character that will remain at -code point 255 on ASCII platforms, but 223 on most EBCDIC platforms -where it will sort to a place less than the EBCDIC numerals. With a +then sort(). Do note however that such Latin-1 manipulation does not +address the E C character that will remain at +code point 255 on ASCII platforms, but 223 on most EBCDIC platforms +where it will sort to a place less than the EBCDIC numerals. With a Unicode-enabled Perl you might try: tr/^?/\x{178}/; -The strategy of mono casing data before sorting does not preserve the case +The strategy of mono casing data before sorting does not preserve the case of the data and may not be acceptable for that reason. =head2 Convert, sort data, then re convert. @@ -1110,15 +1110,15 @@ it would be computationally expensive. =head1 TRANSFORMATION FORMATS -There are a variety of ways of transforming data with an intra character set -mapping that serve a variety of purposes. Sorting was discussed in the -previous section and a few of the other more popular mapping techniques are +There are a variety of ways of transforming data with an intra character set +mapping that serve a variety of purposes. Sorting was discussed in the +previous section and a few of the other more popular mapping techniques are discussed next. =head2 URL decoding and encoding Note that some URLs have hexadecimal ASCII code points in them in an -attempt to overcome character or protocol limitation issues. For example +attempt to overcome character or protocol limitation issues. For example the tilde character is not on every keyboard hence a URL of the form: http://www.pvhp.com/~pvhp/ @@ -1154,7 +1154,7 @@ of decoding such a URL under CCSID 1047: ); $url =~ s/%([0-9a-fA-F]{2})/pack("c",$a2e_1047[hex($1)])/ge; -Conversely, here is a partial solution for the task of encoding such +Conversely, here is a partial solution for the task of encoding such a URL under the 1047 code page: $url = 'http://www.pvhp.com/~pvhp/'; @@ -1177,11 +1177,11 @@ a URL under the 1047 code page: 92,247, 83, 84, 85, 86, 87, 88, 89, 90,178,212,214,210,211,213, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,179,219,220,217,218,159 ); - # The following regular expression does not address the - # mappings for: ('.' => '%2E', '/' => '%2F', ':' => '%3A') + # The following regular expression does not address the + # mappings for: ('.' => '%2E', '/' => '%2F', ':' => '%3A') $url =~ s/([\t "#%&\(\),;<=>\?\@\[\\\]^`{|}~])/sprintf("%%%02X",$e2a_1047[ord($1)])/ge; -where a more complete solution would split the URL into components +where a more complete solution would split the URL into components and apply a full s/// substitution only to the appropriate parts. In the remaining examples a @e2a or @a2e array may be employed @@ -1190,8 +1190,8 @@ you could use the @a2e_1047 or @e2a_1047 arrays just shown. =head2 uu encoding and decoding -The C template to pack() or unpack() will render EBCDIC data in EBCDIC -characters equivalent to their ASCII counterparts. For example, the +The C template to pack() or unpack() will render EBCDIC data in EBCDIC +characters equivalent to their ASCII counterparts. For example, the following will print "Yes indeed\n" on either an ASCII or EBCDIC computer: $all_byte_chrs = ''; @@ -1240,8 +1240,8 @@ the printable set using: # This QP encoder works on ASCII only $qp_string =~ s/([=\x00-\x1F\x80-\xFF])/sprintf("=%02X",ord($1))/ge; -Whereas a QP encoder that works on both ASCII and EBCDIC platforms -would look somewhat like the following (where the EBCDIC branch @e2a +Whereas a QP encoder that works on both ASCII and EBCDIC platforms +would look somewhat like the following (where the EBCDIC branch @e2a array is omitted for brevity): if (ord('A') == 65) { # ASCII @@ -1256,7 +1256,7 @@ array is omitted for brevity): s/([^ !"\#\$%&'()*+,\-.\/0-9:;<>?\@A-Z[\\\]^_`a-z{|}~$delete])/sprintf("=%02X",$e2a[ord($1)])/ge; (although in production code the substitutions might be done -in the EBCDIC branch with the @e2a array and separately in the +in the EBCDIC branch with the @e2a array and separately in the ASCII branch without the expense of the identity map). Such QP strings can be decoded with: @@ -1265,7 +1265,7 @@ Such QP strings can be decoded with: $string =~ s/=([0-9A-Fa-f][0-9A-Fa-f])/chr hex $1/ge; $string =~ s/=[\n\r]+$//; -Whereas a QP decoder that works on both ASCII and EBCDIC platforms +Whereas a QP decoder that works on both ASCII and EBCDIC platforms would look somewhat like the following (where the @a2e array is omitted for brevity): @@ -1276,13 +1276,13 @@ omitted for brevity): The practice of shifting an alphabet one or more characters for encipherment dates back thousands of years and was explicitly detailed by Gaius Julius -Caesar in his B text. A single alphabet shift is sometimes +Caesar in his B text. A single alphabet shift is sometimes referred to as a rotation and the shift amount is given as a number $n after -the string 'rot' or "rot$n". Rot0 and rot26 would designate identity maps -on the 26-letter English version of the Latin alphabet. Rot13 has the -interesting property that alternate subsequent invocations are identity maps -(thus rot13 is its own non-trivial inverse in the group of 26 alphabet -rotations). Hence the following is a rot13 encoder and decoder that will +the string 'rot' or "rot$n". Rot0 and rot26 would designate identity maps +on the 26-letter English version of the Latin alphabet. Rot13 has the +interesting property that alternate subsequent invocations are identity maps +(thus rot13 is its own non-trivial inverse in the group of 26 alphabet +rotations). Hence the following is a rot13 encoder and decoder that will work on ASCII and EBCDIC platforms: #!/usr/local/bin/perl @@ -1299,28 +1299,28 @@ In one-liner form: =head1 Hashing order and checksums -To the extent that it is possible to write code that depends on +To the extent that it is possible to write code that depends on hashing order there may be differences between hashes as stored on an ASCII-based platform and hashes stored on an EBCDIC-based platform. XXX =head1 I18N AND L10N -Internationalization (I18N) and localization (L10N) are supported at least -in principle even on EBCDIC platforms. The details are system-dependent +Internationalization (I18N) and localization (L10N) are supported at least +in principle even on EBCDIC platforms. The details are system-dependent and discussed under the L section below. =head1 MULTI-OCTET CHARACTER SETS -Perl may work with an internal UTF-EBCDIC encoding form for wide characters -on EBCDIC platforms in a manner analogous to the way that it works with +Perl may work with an internal UTF-EBCDIC encoding form for wide characters +on EBCDIC platforms in a manner analogous to the way that it works with the UTF-8 internal encoding form on ASCII based platforms. Legacy multi byte EBCDIC code pages XXX. =head1 OS ISSUES -There may be a few system-dependent issues +There may be a few system-dependent issues of concern to EBCDIC Perl programmers. =head2 OS/400 @@ -1347,7 +1347,7 @@ Perl runs under Unix Systems Services or USS. =item chcp -B is supported as a shell utility for displaying and changing +B is supported as a shell utility for displaying and changing one's code page. See also L. =item dataset access @@ -1385,16 +1385,16 @@ XXX. =head1 BUGS -This pod document contains literal Latin 1 characters and may encounter -translation difficulties. In particular one popular nroff implementation -was known to strip accented characters to their unaccented counterparts -while attempting to view this document through the B program -(for example, you may see a plain C rather than one with a diaeresis +This pod document contains literal Latin 1 characters and may encounter +translation difficulties. In particular one popular nroff implementation +was known to strip accented characters to their unaccented counterparts +while attempting to view this document through the B program +(for example, you may see a plain C rather than one with a diaeresis as in E). Another nroff truncated the resultant manpage at the first occurrence of 8 bit characters. Not all shells will allow multiple C<-e> string arguments to perl to -be concatenated together properly as recipes 0, 2, 4, 5, and 6 might +be concatenated together properly as recipes 0, 2, 4, 5, and 6 might seem to imply. =head1 SEE ALSO @@ -1413,13 +1413,13 @@ L B Tom Jennings, September 1999. -B The Unicode Consortium, Lisa Moore ed., -ISBN 0-201-61633-5, Addison Wesley Developers Press, February 2000. +B The Unicode Consortium, Lisa Moore ed., +ISBN 0-201-61633-5, Addison Wesley Developers Press, February 2000. -B, IBM SC09-2190-00, December 1996. +B, IBM SC09-2190-00, December 1996. -"Demystifying Character Sets", Andrea Vine, Multilingual Computing +"Demystifying Character Sets", Andrea Vine, Multilingual Computing & Technology, B<#26 Vol. 10 Issue 4>, August/September 1999; ISSN 1523-0309; Multilingual Computing Inc. Sandpoint ID, USA. @@ -1436,11 +1436,11 @@ B Robert Bemer. =head1 AUTHOR -Peter Prymmer pvhp@best.com wrote this in 1999 and 2000 -with CCSID 0819 and 0037 help from Chris Leach and -AndrE Pirard A.Pirard@ulg.ac.be as well as POSIX-BC +Peter Prymmer pvhp@best.com wrote this in 1999 and 2000 +with CCSID 0819 and 0037 help from Chris Leach and +AndrE Pirard A.Pirard@ulg.ac.be as well as POSIX-BC help from Thomas Dorner Thomas.Dorner@start.de. -Thanks also to Vickie Cooper, Philip Newton, William Raffloer, and -Joe Smith. Trademarks, registered trademarks, service marks and -registered service marks used in this document are the property of +Thanks also to Vickie Cooper, Philip Newton, William Raffloer, and +Joe Smith. Trademarks, registered trademarks, service marks and +registered service marks used in this document are the property of their respective owners. -- 2.7.4