Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | .\" Automatically generated by Pod::Man v1.34, Pod::Parser v1.13 |
2 | .\" | |
3 | .\" Standard preamble: | |
4 | .\" ======================================================================== | |
5 | .de Sh \" Subsection heading | |
6 | .br | |
7 | .if t .Sp | |
8 | .ne 5 | |
9 | .PP | |
10 | \fB\\$1\fR | |
11 | .PP | |
12 | .. | |
13 | .de Sp \" Vertical space (when we can't use .PP) | |
14 | .if t .sp .5v | |
15 | .if n .sp | |
16 | .. | |
17 | .de Vb \" Begin verbatim text | |
18 | .ft CW | |
19 | .nf | |
20 | .ne \\$1 | |
21 | .. | |
22 | .de Ve \" End verbatim text | |
23 | .ft R | |
24 | .fi | |
25 | .. | |
26 | .\" Set up some character translations and predefined strings. \*(-- will | |
27 | .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left | |
28 | .\" double quote, and \*(R" will give a right double quote. | will give a | |
29 | .\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to | |
30 | .\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' | |
31 | .\" expand to `' in nroff, nothing in troff, for use with C<>. | |
32 | .tr \(*W-|\(bv\*(Tr | |
33 | .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' | |
34 | .ie n \{\ | |
35 | . ds -- \(*W- | |
36 | . ds PI pi | |
37 | . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch | |
38 | . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch | |
39 | . ds L" "" | |
40 | . ds R" "" | |
41 | . ds C` "" | |
42 | . ds C' "" | |
43 | 'br\} | |
44 | .el\{\ | |
45 | . ds -- \|\(em\| | |
46 | . ds PI \(*p | |
47 | . ds L" `` | |
48 | . ds R" '' | |
49 | 'br\} | |
50 | .\" | |
51 | .\" If the F register is turned on, we'll generate index entries on stderr for | |
52 | .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index | |
53 | .\" entries marked with X<> in POD. Of course, you'll have to process the | |
54 | .\" output yourself in some meaningful fashion. | |
55 | .if \nF \{\ | |
56 | . de IX | |
57 | . tm Index:\\$1\t\\n%\t"\\$2" | |
58 | .. | |
59 | . nr % 0 | |
60 | . rr F | |
61 | .\} | |
62 | .\" | |
63 | .\" For nroff, turn off justification. Always turn off hyphenation; it makes | |
64 | .\" way too many mistakes in technical documents. | |
65 | .hy 0 | |
66 | .if n .na | |
67 | .\" | |
68 | .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). | |
69 | .\" Fear. Run. Save yourself. No user-serviceable parts. | |
70 | . \" fudge factors for nroff and troff | |
71 | .if n \{\ | |
72 | . ds #H 0 | |
73 | . ds #V .8m | |
74 | . ds #F .3m | |
75 | . ds #[ \f1 | |
76 | . ds #] \fP | |
77 | .\} | |
78 | .if t \{\ | |
79 | . ds #H ((1u-(\\\\n(.fu%2u))*.13m) | |
80 | . ds #V .6m | |
81 | . ds #F 0 | |
82 | . ds #[ \& | |
83 | . ds #] \& | |
84 | .\} | |
85 | . \" simple accents for nroff and troff | |
86 | .if n \{\ | |
87 | . ds ' \& | |
88 | . ds ` \& | |
89 | . ds ^ \& | |
90 | . ds , \& | |
91 | . ds ~ ~ | |
92 | . ds / | |
93 | .\} | |
94 | .if t \{\ | |
95 | . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" | |
96 | . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' | |
97 | . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' | |
98 | . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' | |
99 | . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' | |
100 | . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' | |
101 | .\} | |
102 | . \" troff and (daisy-wheel) nroff accents | |
103 | .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' | |
104 | .ds 8 \h'\*(#H'\(*b\h'-\*(#H' | |
105 | .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] | |
106 | .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' | |
107 | .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' | |
108 | .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] | |
109 | .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] | |
110 | .ds ae a\h'-(\w'a'u*4/10)'e | |
111 | .ds Ae A\h'-(\w'A'u*4/10)'E | |
112 | . \" corrections for vroff | |
113 | .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' | |
114 | .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' | |
115 | . \" for low resolution devices (crt and lpr) | |
116 | .if \n(.H>23 .if \n(.V>19 \ | |
117 | \{\ | |
118 | . ds : e | |
119 | . ds 8 ss | |
120 | . ds o a | |
121 | . ds d- d\h'-1'\(ga | |
122 | . ds D- D\h'-1'\(hy | |
123 | . ds th \o'bp' | |
124 | . ds Th \o'LP' | |
125 | . ds ae ae | |
126 | . ds Ae AE | |
127 | .\} | |
128 | .rm #[ #] #H #V #F C | |
129 | .\" ======================================================================== | |
130 | .\" | |
131 | .IX Title "PERLEBCDIC 1" | |
132 | .TH PERLEBCDIC 1 "2002-06-08" "perl v5.8.0" "Perl Programmers Reference Guide" | |
133 | .SH "NAME" | |
134 | perlebcdic \- Considerations for running Perl on EBCDIC platforms | |
135 | .SH "DESCRIPTION" | |
136 | .IX Header "DESCRIPTION" | |
137 | An exploration of some of the issues facing Perl programmers | |
138 | on \s-1EBCDIC\s0 based computers. We do not cover localization, | |
139 | internationalization, or multi byte character set issues other | |
140 | than some discussion of \s-1UTF\-8\s0 and \s-1UTF\-EBCDIC\s0. | |
141 | .PP | |
142 | Portions that are still incomplete are marked with \s-1XXX\s0. | |
143 | .SH "COMMON CHARACTER CODE SETS" | |
144 | .IX Header "COMMON CHARACTER CODE SETS" | |
145 | .Sh "\s-1ASCII\s0" | |
146 | .IX Subsection "ASCII" | |
147 | The American Standard Code for Information Interchange is a set of | |
148 | integers running from 0 to 127 (decimal) that imply character | |
149 | interpretation by the display and other system(s) of computers. | |
150 | The range 0..127 can be covered by setting the bits in a 7\-bit binary | |
151 | digit, hence the set is sometimes referred to as a \*(L"7\-bit \s-1ASCII\s0\*(R". | |
152 | \&\s-1ASCII\s0 was described by the American National Standards Institute | |
153 | document \s-1ANSI\s0 X3.4\-1986. It was also described by \s-1ISO\s0 646:1991 | |
154 | (with localization for currency symbols). The full \s-1ASCII\s0 set is | |
155 | given in the table below as the first 128 elements. Languages that | |
156 | can be written adequately with the characters in \s-1ASCII\s0 include | |
157 | English, Hawaiian, Indonesian, Swahili and some Native American | |
158 | languages. | |
159 | .PP | |
160 | There are many character sets that extend the range of integers | |
161 | from 0..2**7\-1 up to 2**8\-1, or 8 bit bytes (octets if you prefer). | |
162 | One common one is the \s-1ISO\s0 8859\-1 character set. | |
163 | .Sh "\s-1ISO\s0 8859" | |
164 | .IX Subsection "ISO 8859" | |
165 | The \s-1ISO\s0 8859\-$n are a collection of character code sets from the | |
166 | International Organization for Standardization (\s-1ISO\s0) each of which | |
167 | adds characters to the \s-1ASCII\s0 set that are typically found in European | |
168 | languages many of which are based on the Roman, or Latin, alphabet. | |
169 | .Sh "Latin 1 (\s-1ISO\s0 8859\-1)" | |
170 | .IX Subsection "Latin 1 (ISO 8859-1)" | |
171 | A particular 8\-bit extension to \s-1ASCII\s0 that includes grave and acute | |
172 | accented Latin characters. Languages that can employ \s-1ISO\s0 8859\-1 | |
173 | include all the languages covered by \s-1ASCII\s0 as well as Afrikaans, | |
174 | Albanian, Basque, Catalan, Danish, Faroese, Finnish, Norwegian, | |
175 | Portuguese, Spanish, and Swedish. Dutch is covered albeit without | |
176 | the ij ligature. French is covered too but without the oe ligature. | |
177 | German can use \s-1ISO\s0 8859\-1 but must do so without German-style | |
178 | quotation marks. This set is based on Western European extensions | |
179 | to \s-1ASCII\s0 and is commonly encountered in world wide web work. | |
180 | In \s-1IBM\s0 character code set identification terminology \s-1ISO\s0 8859\-1 is | |
181 | also known as \s-1CCSID\s0 819 (or sometimes 0819 or even 00819). | |
182 | .Sh "\s-1EBCDIC\s0" | |
183 | .IX Subsection "EBCDIC" | |
184 | The Extended Binary Coded Decimal Interchange Code refers to a | |
185 | large collection of slightly different single and multi byte | |
186 | coded character sets that are different from \s-1ASCII\s0 or \s-1ISO\s0 8859\-1 | |
187 | and typically run on host computers. The \s-1EBCDIC\s0 encodings derive | |
188 | from 8 bit byte extensions of Hollerith punched card encodings. | |
189 | The layout on the cards was such that high bits were set for the | |
190 | upper and lower case alphabet characters [a\-z] and [A\-Z], but there | |
191 | were gaps within each latin alphabet range. | |
192 | .PP | |
193 | Some \s-1IBM\s0 \s-1EBCDIC\s0 character sets may be known by character code set | |
194 | identification numbers (\s-1CCSID\s0 numbers) or code page numbers. Leading | |
195 | zero digits in \s-1CCSID\s0 numbers within this document are insignificant. | |
196 | E.g. \s-1CCSID\s0 0037 may be referred to as 37 in places. | |
197 | .Sh "13 variant characters" | |
198 | .IX Subsection "13 variant characters" | |
199 | Among \s-1IBM\s0 \s-1EBCDIC\s0 character code sets there are 13 characters that | |
200 | are often mapped to different integer values. Those characters | |
201 | are known as the 13 \*(L"variant\*(R" characters and are: | |
202 | .PP | |
203 | .Vb 1 | |
204 | \& \e [ ] { } ^ ~ ! # | $ @ ` | |
205 | .Ve | |
206 | .Sh "0037" | |
207 | .IX Subsection "0037" | |
208 | Character code set \s-1ID\s0 0037 is a mapping of the \s-1ASCII\s0 plus Latin\-1 | |
209 | characters (i.e. \s-1ISO\s0 8859\-1) to an \s-1EBCDIC\s0 set. 0037 is used | |
210 | in North American English locales on the \s-1OS/400\s0 operating system | |
211 | that runs on \s-1AS/400\s0 computers. \s-1CCSID\s0 37 differs from \s-1ISO\s0 8859\-1 | |
212 | in 237 places, in other words they agree on only 19 code point values. | |
213 | .Sh "1047" | |
214 | .IX Subsection "1047" | |
215 | Character code set \s-1ID\s0 1047 is also a mapping of the \s-1ASCII\s0 plus | |
216 | Latin\-1 characters (i.e. \s-1ISO\s0 8859\-1) to an \s-1EBCDIC\s0 set. 1047 is | |
217 | used under Unix System Services for \s-1OS/390\s0 or z/OS, and OpenEdition | |
218 | for \s-1VM/ESA\s0. \s-1CCSID\s0 1047 differs from \s-1CCSID\s0 0037 in eight places. | |
219 | .Sh "POSIX-BC" | |
220 | .IX Subsection "POSIX-BC" | |
221 | The \s-1EBCDIC\s0 code page in use on Siemens' \s-1BS2000\s0 system is distinct from | |
222 | 1047 and 0037. It is identified below as the POSIX-BC set. | |
223 | .Sh "Unicode code points versus \s-1EBCDIC\s0 code points" | |
224 | .IX Subsection "Unicode code points versus EBCDIC code points" | |
225 | In Unicode terminology a \fIcode point\fR is the number assigned to a | |
226 | character: for example, in \s-1EBCDIC\s0 the character \*(L"A\*(R" is usually assigned | |
227 | the number 193. In Unicode the character \*(L"A\*(R" is assigned the number 65. | |
228 | This causes a problem with the semantics of the pack/unpack \*(L"U\*(R", which | |
229 | are supposed to pack Unicode code points to characters and back to numbers. | |
230 | The problem is: which code points to use for code points less than 256? | |
231 | (for 256 and over there's no problem: Unicode code points are used) | |
232 | In \s-1EBCDIC\s0, for the low 256 the \s-1EBCDIC\s0 code points are used. This | |
233 | means that the equivalences | |
234 | .PP | |
235 | .Vb 2 | |
236 | \& pack("U", ord($character)) eq $character | |
237 | \& unpack("U", $character) == ord $character | |
238 | .Ve | |
239 | .PP | |
240 | will hold. (If Unicode code points were applied consistently over | |
241 | all the possible code points, pack(\*(L"U\*(R",ord(\*(L"A\*(R")) would in \s-1EBCDIC\s0 | |
242 | equal \fIA with acute\fR or chr(101), and unpack(\*(L"U\*(R", \*(L"A\*(R") would equal | |
243 | 65, or \fInon-breaking space\fR, not 193, or ord \*(L"A\*(R".) | |
244 | .Sh "Remaining Perl Unicode problems in \s-1EBCDIC\s0" | |
245 | .IX Subsection "Remaining Perl Unicode problems in EBCDIC" | |
246 | .IP "\(bu" 4 | |
247 | Many of the remaining seem to be related to case-insensitive matching: | |
248 | for example, \f(CW\*(C`/[\ex{131}]/\*(C'\fR (\s-1LATIN\s0 \s-1SMALL\s0 \s-1LETTER\s0 \s-1DOTLESS\s0 I) does | |
249 | not match \*(L"I\*(R" case\-insensitively, as it should under Unicode. | |
250 | (The match succeeds in ASCII-derived platforms.) | |
251 | .IP "\(bu" 4 | |
252 | The extensions Unicode::Collate and Unicode::Normalized are not | |
253 | supported under \s-1EBCDIC\s0, likewise for the encoding pragma. | |
254 | .Sh "Unicode and \s-1UTF\s0" | |
255 | .IX Subsection "Unicode and UTF" | |
256 | \&\s-1UTF\s0 is a Unicode Transformation Format. \s-1UTF\-8\s0 is a Unicode conforming | |
257 | representation of the Unicode standard that looks very much like \s-1ASCII\s0. | |
258 | UTF-EBCDIC is an attempt to represent Unicode characters in an \s-1EBCDIC\s0 | |
259 | transparent manner. | |
260 | .Sh "Using Encode" | |
261 | .IX Subsection "Using Encode" | |
262 | Starting from Perl 5.8 you can use the standard new module Encode | |
263 | to translate from \s-1EBCDIC\s0 to Latin\-1 code points | |
264 | .PP | |
265 | .Vb 1 | |
266 | \& use Encode 'from_to'; | |
267 | .Ve | |
268 | .PP | |
269 | .Vb 1 | |
270 | \& my %ebcdic = ( 176 => 'cp37', 95 => 'cp1047', 106 => 'posix-bc' ); | |
271 | .Ve | |
272 | .PP | |
273 | .Vb 3 | |
274 | \& # $a is in EBCDIC code points | |
275 | \& from_to($a, $ebcdic{ord '^'}, 'latin1'); | |
276 | \& # $a is ISO 8859-1 code points | |
277 | .Ve | |
278 | .PP | |
279 | and from Latin\-1 code points to \s-1EBCDIC\s0 code points | |
280 | .PP | |
281 | .Vb 1 | |
282 | \& use Encode 'from_to'; | |
283 | .Ve | |
284 | .PP | |
285 | .Vb 1 | |
286 | \& my %ebcdic = ( 176 => 'cp37', 95 => 'cp1047', 106 => 'posix-bc' ); | |
287 | .Ve | |
288 | .PP | |
289 | .Vb 3 | |
290 | \& # $a is ISO 8859-1 code points | |
291 | \& from_to($a, 'latin1', $ebcdic{ord '^'}); | |
292 | \& # $a is in EBCDIC code points | |
293 | .Ve | |
294 | .PP | |
295 | For doing I/O it is suggested that you use the autotranslating features | |
296 | of PerlIO, see perluniintro. | |
297 | .SH "SINGLE OCTET TABLES" | |
298 | .IX Header "SINGLE OCTET TABLES" | |
299 | The following tables list the \s-1ASCII\s0 and Latin 1 ordered sets including | |
300 | the subsets: C0 controls (0..31), \s-1ASCII\s0 graphics (32..7e), delete (7f), | |
301 | C1 controls (80..9f), and Latin\-1 (a.k.a. \s-1ISO\s0 8859\-1) (a0..ff). In the | |
302 | table non-printing control character names as well as the Latin 1 | |
303 | extensions to \s-1ASCII\s0 have been labelled with character names roughly | |
304 | corresponding to \fIThe Unicode Standard, Version 3.0\fR albeit with | |
305 | substitutions such as s/LATIN// and s/VULGAR// in all cases, | |
306 | s/CAPITAL \s-1LETTER//\s0 in some cases, and s/SMALL \s-1LETTER\s0 ([A\-Z])/\el$1/ | |
307 | in some other cases (the \f(CW\*(C`charnames\*(C'\fR pragma names unfortunately do | |
308 | not list explicit names for the C0 or C1 control characters). The | |
309 | \&\*(L"names\*(R" of the C1 control set (128..159 in \s-1ISO\s0 8859\-1) listed here are | |
310 | somewhat arbitrary. The differences between the 0037 and 1047 sets are | |
311 | flagged with ***. The differences between the 1047 and POSIX-BC sets | |
312 | are flagged with ###. All \fIord()\fR numbers listed are decimal. If you | |
313 | would rather see this table listing octal values then run the table | |
314 | (that is, the pod version of this document since this recipe may not | |
315 | work with a pod2_other_format translation) through: | |
316 | .IP "recipe 0" 4 | |
317 | .IX Item "recipe 0" | |
318 | .PP | |
319 | .Vb 2 | |
320 | \& perl -ne 'if(/(.{33})(\ed+)\es+(\ed+)\es+(\ed+)\es+(\ed+)/)' \e | |
321 | \& -e '{printf("%s%-9o%-9o%-9o%o\en",$1,$2,$3,$4,$5)}' perlebcdic.pod | |
322 | .Ve | |
323 | .PP | |
324 | If you want to retain the UTF-x code points then in script form you | |
325 | might want to write: | |
326 | .IP "recipe 1" 4 | |
327 | .IX Item "recipe 1" | |
328 | .PP | |
329 | .Vb 14 | |
330 | \& open(FH,"<perlebcdic.pod") or die "Could not open perlebcdic.pod: $!"; | |
331 | \& while (<FH>) { | |
332 | \& if (/(.{33})(\ed+)\es+(\ed+)\es+(\ed+)\es+(\ed+)\es+(\ed+)\e.?(\ed*)\es+(\ed+)\e.?(\ed*)/) { | |
333 | \& if ($7 ne '' && $9 ne '') { | |
334 | \& printf("%s%-9o%-9o%-9o%-9o%-3o.%-5o%-3o.%o\en",$1,$2,$3,$4,$5,$6,$7,$8,$9); | |
335 | \& } | |
336 | \& elsif ($7 ne '') { | |
337 | \& printf("%s%-9o%-9o%-9o%-9o%-3o.%-5o%o\en",$1,$2,$3,$4,$5,$6,$7,$8); | |
338 | \& } | |
339 | \& else { | |
340 | \& printf("%s%-9o%-9o%-9o%-9o%-9o%o\en",$1,$2,$3,$4,$5,$6,$8); | |
341 | \& } | |
342 | \& } | |
343 | \& } | |
344 | .Ve | |
345 | .PP | |
346 | If you would rather see this table listing hexadecimal values then | |
347 | run the table through: | |
348 | .IP "recipe 2" 4 | |
349 | .IX Item "recipe 2" | |
350 | .PP | |
351 | .Vb 2 | |
352 | \& perl -ne 'if(/(.{33})(\ed+)\es+(\ed+)\es+(\ed+)\es+(\ed+)/)' \e | |
353 | \& -e '{printf("%s%-9X%-9X%-9X%X\en",$1,$2,$3,$4,$5)}' perlebcdic.pod | |
354 | .Ve | |
355 | .PP | |
356 | Or, in order to retain the UTF-x code points in hexadecimal: | |
357 | .IP "recipe 3" 4 | |
358 | .IX Item "recipe 3" | |
359 | .PP | |
360 | .Vb 14 | |
361 | \& open(FH,"<perlebcdic.pod") or die "Could not open perlebcdic.pod: $!"; | |
362 | \& while (<FH>) { | |
363 | \& if (/(.{33})(\ed+)\es+(\ed+)\es+(\ed+)\es+(\ed+)\es+(\ed+)\e.?(\ed*)\es+(\ed+)\e.?(\ed*)/) { | |
364 | \& if ($7 ne '' && $9 ne '') { | |
365 | \& printf("%s%-9X%-9X%-9X%-9X%-2X.%-6X%-2X.%X\en",$1,$2,$3,$4,$5,$6,$7,$8,$9); | |
366 | \& } | |
367 | \& elsif ($7 ne '') { | |
368 | \& printf("%s%-9X%-9X%-9X%-9X%-2X.%-6X%X\en",$1,$2,$3,$4,$5,$6,$7,$8); | |
369 | \& } | |
370 | \& else { | |
371 | \& printf("%s%-9X%-9X%-9X%-9X%-9X%X\en",$1,$2,$3,$4,$5,$6,$8); | |
372 | \& } | |
373 | \& } | |
374 | \& } | |
375 | .Ve | |
376 | .PP | |
377 | .Vb 260 | |
378 | \& incomp- incomp- | |
379 | \& 8859-1 lete lete | |
380 | \& chr 0819 0037 1047 POSIX-BC UTF-8 UTF-EBCDIC | |
381 | \& ------------------------------------------------------------------------------------ | |
382 | \& <NULL> 0 0 0 0 0 0 | |
383 | \& <START OF HEADING> 1 1 1 1 1 1 | |
384 | \& <START OF TEXT> 2 2 2 2 2 2 | |
385 | \& <END OF TEXT> 3 3 3 3 3 3 | |
386 | \& <END OF TRANSMISSION> 4 55 55 55 4 55 | |
387 | \& <ENQUIRY> 5 45 45 45 5 45 | |
388 | \& <ACKNOWLEDGE> 6 46 46 46 6 46 | |
389 | \& <BELL> 7 47 47 47 7 47 | |
390 | \& <BACKSPACE> 8 22 22 22 8 22 | |
391 | \& <HORIZONTAL TABULATION> 9 5 5 5 9 5 | |
392 | \& <LINE FEED> 10 37 21 21 10 21 *** | |
393 | \& <VERTICAL TABULATION> 11 11 11 11 11 11 | |
394 | \& <FORM FEED> 12 12 12 12 12 12 | |
395 | \& <CARRIAGE RETURN> 13 13 13 13 13 13 | |
396 | \& <SHIFT OUT> 14 14 14 14 14 14 | |
397 | \& <SHIFT IN> 15 15 15 15 15 15 | |
398 | \& <DATA LINK ESCAPE> 16 16 16 16 16 16 | |
399 | \& <DEVICE CONTROL ONE> 17 17 17 17 17 17 | |
400 | \& <DEVICE CONTROL TWO> 18 18 18 18 18 18 | |
401 | \& <DEVICE CONTROL THREE> 19 19 19 19 19 19 | |
402 | \& <DEVICE CONTROL FOUR> 20 60 60 60 20 60 | |
403 | \& <NEGATIVE ACKNOWLEDGE> 21 61 61 61 21 61 | |
404 | \& <SYNCHRONOUS IDLE> 22 50 50 50 22 50 | |
405 | \& <END OF TRANSMISSION BLOCK> 23 38 38 38 23 38 | |
406 | \& <CANCEL> 24 24 24 24 24 24 | |
407 | \& <END OF MEDIUM> 25 25 25 25 25 25 | |
408 | \& <SUBSTITUTE> 26 63 63 63 26 63 | |
409 | \& <ESCAPE> 27 39 39 39 27 39 | |
410 | \& <FILE SEPARATOR> 28 28 28 28 28 28 | |
411 | \& <GROUP SEPARATOR> 29 29 29 29 29 29 | |
412 | \& <RECORD SEPARATOR> 30 30 30 30 30 30 | |
413 | \& <UNIT SEPARATOR> 31 31 31 31 31 31 | |
414 | \& <SPACE> 32 64 64 64 32 64 | |
415 | \& ! 33 90 90 90 33 90 | |
416 | \& " 34 127 127 127 34 127 | |
417 | \& # 35 123 123 123 35 123 | |
418 | \& $ 36 91 91 91 36 91 | |
419 | \& % 37 108 108 108 37 108 | |
420 | \& & 38 80 80 80 38 80 | |
421 | \& ' 39 125 125 125 39 125 | |
422 | \& ( 40 77 77 77 40 77 | |
423 | \& ) 41 93 93 93 41 93 | |
424 | \& * 42 92 92 92 42 92 | |
425 | \& + 43 78 78 78 43 78 | |
426 | \& , 44 107 107 107 44 107 | |
427 | \& - 45 96 96 96 45 96 | |
428 | \& . 46 75 75 75 46 75 | |
429 | \& / 47 97 97 97 47 97 | |
430 | \& 0 48 240 240 240 48 240 | |
431 | \& 1 49 241 241 241 49 241 | |
432 | \& 2 50 242 242 242 50 242 | |
433 | \& 3 51 243 243 243 51 243 | |
434 | \& 4 52 244 244 244 52 244 | |
435 | \& 5 53 245 245 245 53 245 | |
436 | \& 6 54 246 246 246 54 246 | |
437 | \& 7 55 247 247 247 55 247 | |
438 | \& 8 56 248 248 248 56 248 | |
439 | \& 9 57 249 249 249 57 249 | |
440 | \& : 58 122 122 122 58 122 | |
441 | \& ; 59 94 94 94 59 94 | |
442 | \& < 60 76 76 76 60 76 | |
443 | \& = 61 126 126 126 61 126 | |
444 | \& > 62 110 110 110 62 110 | |
445 | \& ? 63 111 111 111 63 111 | |
446 | \& @ 64 124 124 124 64 124 | |
447 | \& A 65 193 193 193 65 193 | |
448 | \& B 66 194 194 194 66 194 | |
449 | \& C 67 195 195 195 67 195 | |
450 | \& D 68 196 196 196 68 196 | |
451 | \& E 69 197 197 197 69 197 | |
452 | \& F 70 198 198 198 70 198 | |
453 | \& G 71 199 199 199 71 199 | |
454 | \& H 72 200 200 200 72 200 | |
455 | \& I 73 201 201 201 73 201 | |
456 | \& J 74 209 209 209 74 209 | |
457 | \& K 75 210 210 210 75 210 | |
458 | \& L 76 211 211 211 76 211 | |
459 | \& M 77 212 212 212 77 212 | |
460 | \& N 78 213 213 213 78 213 | |
461 | \& O 79 214 214 214 79 214 | |
462 | \& P 80 215 215 215 80 215 | |
463 | \& Q 81 216 216 216 81 216 | |
464 | \& R 82 217 217 217 82 217 | |
465 | \& S 83 226 226 226 83 226 | |
466 | \& T 84 227 227 227 84 227 | |
467 | \& U 85 228 228 228 85 228 | |
468 | \& V 86 229 229 229 86 229 | |
469 | \& W 87 230 230 230 87 230 | |
470 | \& X 88 231 231 231 88 231 | |
471 | \& Y 89 232 232 232 89 232 | |
472 | \& Z 90 233 233 233 90 233 | |
473 | \& [ 91 186 173 187 91 173 *** ### | |
474 | \& \e 92 224 224 188 92 224 ### | |
475 | \& ] 93 187 189 189 93 189 *** | |
476 | \& ^ 94 176 95 106 94 95 *** ### | |
477 | \& _ 95 109 109 109 95 109 | |
478 | \& ` 96 121 121 74 96 121 ### | |
479 | \& a 97 129 129 129 97 129 | |
480 | \& b 98 130 130 130 98 130 | |
481 | \& c 99 131 131 131 99 131 | |
482 | \& d 100 132 132 132 100 132 | |
483 | \& e 101 133 133 133 101 133 | |
484 | \& f 102 134 134 134 102 134 | |
485 | \& g 103 135 135 135 103 135 | |
486 | \& h 104 136 136 136 104 136 | |
487 | \& i 105 137 137 137 105 137 | |
488 | \& j 106 145 145 145 106 145 | |
489 | \& k 107 146 146 146 107 146 | |
490 | \& l 108 147 147 147 108 147 | |
491 | \& m 109 148 148 148 109 148 | |
492 | \& n 110 149 149 149 110 149 | |
493 | \& o 111 150 150 150 111 150 | |
494 | \& p 112 151 151 151 112 151 | |
495 | \& q 113 152 152 152 113 152 | |
496 | \& r 114 153 153 153 114 153 | |
497 | \& s 115 162 162 162 115 162 | |
498 | \& t 116 163 163 163 116 163 | |
499 | \& u 117 164 164 164 117 164 | |
500 | \& v 118 165 165 165 118 165 | |
501 | \& w 119 166 166 166 119 166 | |
502 | \& x 120 167 167 167 120 167 | |
503 | \& y 121 168 168 168 121 168 | |
504 | \& z 122 169 169 169 122 169 | |
505 | \& { 123 192 192 251 123 192 ### | |
506 | \& | 124 79 79 79 124 79 | |
507 | \& } 125 208 208 253 125 208 ### | |
508 | \& ~ 126 161 161 255 126 161 ### | |
509 | \& <DELETE> 127 7 7 7 127 7 | |
510 | \& <C1 0> 128 32 32 32 194.128 32 | |
511 | \& <C1 1> 129 33 33 33 194.129 33 | |
512 | \& <C1 2> 130 34 34 34 194.130 34 | |
513 | \& <C1 3> 131 35 35 35 194.131 35 | |
514 | \& <C1 4> 132 36 36 36 194.132 36 | |
515 | \& <C1 5> 133 21 37 37 194.133 37 *** | |
516 | \& <C1 6> 134 6 6 6 194.134 6 | |
517 | \& <C1 7> 135 23 23 23 194.135 23 | |
518 | \& <C1 8> 136 40 40 40 194.136 40 | |
519 | \& <C1 9> 137 41 41 41 194.137 41 | |
520 | \& <C1 10> 138 42 42 42 194.138 42 | |
521 | \& <C1 11> 139 43 43 43 194.139 43 | |
522 | \& <C1 12> 140 44 44 44 194.140 44 | |
523 | \& <C1 13> 141 9 9 9 194.141 9 | |
524 | \& <C1 14> 142 10 10 10 194.142 10 | |
525 | \& <C1 15> 143 27 27 27 194.143 27 | |
526 | \& <C1 16> 144 48 48 48 194.144 48 | |
527 | \& <C1 17> 145 49 49 49 194.145 49 | |
528 | \& <C1 18> 146 26 26 26 194.146 26 | |
529 | \& <C1 19> 147 51 51 51 194.147 51 | |
530 | \& <C1 20> 148 52 52 52 194.148 52 | |
531 | \& <C1 21> 149 53 53 53 194.149 53 | |
532 | \& <C1 22> 150 54 54 54 194.150 54 | |
533 | \& <C1 23> 151 8 8 8 194.151 8 | |
534 | \& <C1 24> 152 56 56 56 194.152 56 | |
535 | \& <C1 25> 153 57 57 57 194.153 57 | |
536 | \& <C1 26> 154 58 58 58 194.154 58 | |
537 | \& <C1 27> 155 59 59 59 194.155 59 | |
538 | \& <C1 28> 156 4 4 4 194.156 4 | |
539 | \& <C1 29> 157 20 20 20 194.157 20 | |
540 | \& <C1 30> 158 62 62 62 194.158 62 | |
541 | \& <C1 31> 159 255 255 95 194.159 255 ### | |
542 | \& <NON-BREAKING SPACE> 160 65 65 65 194.160 128.65 | |
543 | \& <INVERTED EXCLAMATION MARK> 161 170 170 170 194.161 128.66 | |
544 | \& <CENT SIGN> 162 74 74 176 194.162 128.67 ### | |
545 | \& <POUND SIGN> 163 177 177 177 194.163 128.68 | |
546 | \& <CURRENCY SIGN> 164 159 159 159 194.164 128.69 | |
547 | \& <YEN SIGN> 165 178 178 178 194.165 128.70 | |
548 | \& <BROKEN BAR> 166 106 106 208 194.166 128.71 ### | |
549 | \& <SECTION SIGN> 167 181 181 181 194.167 128.72 | |
550 | \& <DIAERESIS> 168 189 187 121 194.168 128.73 *** ### | |
551 | \& <COPYRIGHT SIGN> 169 180 180 180 194.169 128.74 | |
552 | \& <FEMININE ORDINAL INDICATOR> 170 154 154 154 194.170 128.81 | |
553 | \& <LEFT POINTING GUILLEMET> 171 138 138 138 194.171 128.82 | |
554 | \& <NOT SIGN> 172 95 176 186 194.172 128.83 *** ### | |
555 | \& <SOFT HYPHEN> 173 202 202 202 194.173 128.84 | |
556 | \& <REGISTERED TRADE MARK SIGN> 174 175 175 175 194.174 128.85 | |
557 | \& <MACRON> 175 188 188 161 194.175 128.86 ### | |
558 | \& <DEGREE SIGN> 176 144 144 144 194.176 128.87 | |
559 | \& <PLUS-OR-MINUS SIGN> 177 143 143 143 194.177 128.88 | |
560 | \& <SUPERSCRIPT TWO> 178 234 234 234 194.178 128.89 | |
561 | \& <SUPERSCRIPT THREE> 179 250 250 250 194.179 128.98 | |
562 | \& <ACUTE ACCENT> 180 190 190 190 194.180 128.99 | |
563 | \& <MICRO SIGN> 181 160 160 160 194.181 128.100 | |
564 | \& <PARAGRAPH SIGN> 182 182 182 182 194.182 128.101 | |
565 | \& <MIDDLE DOT> 183 179 179 179 194.183 128.102 | |
566 | \& <CEDILLA> 184 157 157 157 194.184 128.103 | |
567 | \& <SUPERSCRIPT ONE> 185 218 218 218 194.185 128.104 | |
568 | \& <MASC. ORDINAL INDICATOR> 186 155 155 155 194.186 128.105 | |
569 | \& <RIGHT POINTING GUILLEMET> 187 139 139 139 194.187 128.106 | |
570 | \& <FRACTION ONE QUARTER> 188 183 183 183 194.188 128.112 | |
571 | \& <FRACTION ONE HALF> 189 184 184 184 194.189 128.113 | |
572 | \& <FRACTION THREE QUARTERS> 190 185 185 185 194.190 128.114 | |
573 | \& <INVERTED QUESTION MARK> 191 171 171 171 194.191 128.115 | |
574 | \& <A WITH GRAVE> 192 100 100 100 195.128 138.65 | |
575 | \& <A WITH ACUTE> 193 101 101 101 195.129 138.66 | |
576 | \& <A WITH CIRCUMFLEX> 194 98 98 98 195.130 138.67 | |
577 | \& <A WITH TILDE> 195 102 102 102 195.131 138.68 | |
578 | \& <A WITH DIAERESIS> 196 99 99 99 195.132 138.69 | |
579 | \& <A WITH RING ABOVE> 197 103 103 103 195.133 138.70 | |
580 | \& <CAPITAL LIGATURE AE> 198 158 158 158 195.134 138.71 | |
581 | \& <C WITH CEDILLA> 199 104 104 104 195.135 138.72 | |
582 | \& <E WITH GRAVE> 200 116 116 116 195.136 138.73 | |
583 | \& <E WITH ACUTE> 201 113 113 113 195.137 138.74 | |
584 | \& <E WITH CIRCUMFLEX> 202 114 114 114 195.138 138.81 | |
585 | \& <E WITH DIAERESIS> 203 115 115 115 195.139 138.82 | |
586 | \& <I WITH GRAVE> 204 120 120 120 195.140 138.83 | |
587 | \& <I WITH ACUTE> 205 117 117 117 195.141 138.84 | |
588 | \& <I WITH CIRCUMFLEX> 206 118 118 118 195.142 138.85 | |
589 | \& <I WITH DIAERESIS> 207 119 119 119 195.143 138.86 | |
590 | \& <CAPITAL LETTER ETH> 208 172 172 172 195.144 138.87 | |
591 | \& <N WITH TILDE> 209 105 105 105 195.145 138.88 | |
592 | \& <O WITH GRAVE> 210 237 237 237 195.146 138.89 | |
593 | \& <O WITH ACUTE> 211 238 238 238 195.147 138.98 | |
594 | \& <O WITH CIRCUMFLEX> 212 235 235 235 195.148 138.99 | |
595 | \& <O WITH TILDE> 213 239 239 239 195.149 138.100 | |
596 | \& <O WITH DIAERESIS> 214 236 236 236 195.150 138.101 | |
597 | \& <MULTIPLICATION SIGN> 215 191 191 191 195.151 138.102 | |
598 | \& <O WITH STROKE> 216 128 128 128 195.152 138.103 | |
599 | \& <U WITH GRAVE> 217 253 253 224 195.153 138.104 ### | |
600 | \& <U WITH ACUTE> 218 254 254 254 195.154 138.105 | |
601 | \& <U WITH CIRCUMFLEX> 219 251 251 221 195.155 138.106 ### | |
602 | \& <U WITH DIAERESIS> 220 252 252 252 195.156 138.112 | |
603 | \& <Y WITH ACUTE> 221 173 186 173 195.157 138.113 *** ### | |
604 | \& <CAPITAL LETTER THORN> 222 174 174 174 195.158 138.114 | |
605 | \& <SMALL LETTER SHARP S> 223 89 89 89 195.159 138.115 | |
606 | \& <a WITH GRAVE> 224 68 68 68 195.160 139.65 | |
607 | \& <a WITH ACUTE> 225 69 69 69 195.161 139.66 | |
608 | \& <a WITH CIRCUMFLEX> 226 66 66 66 195.162 139.67 | |
609 | \& <a WITH TILDE> 227 70 70 70 195.163 139.68 | |
610 | \& <a WITH DIAERESIS> 228 67 67 67 195.164 139.69 | |
611 | \& <a WITH RING ABOVE> 229 71 71 71 195.165 139.70 | |
612 | \& <SMALL LIGATURE ae> 230 156 156 156 195.166 139.71 | |
613 | \& <c WITH CEDILLA> 231 72 72 72 195.167 139.72 | |
614 | \& <e WITH GRAVE> 232 84 84 84 195.168 139.73 | |
615 | \& <e WITH ACUTE> 233 81 81 81 195.169 139.74 | |
616 | \& <e WITH CIRCUMFLEX> 234 82 82 82 195.170 139.81 | |
617 | \& <e WITH DIAERESIS> 235 83 83 83 195.171 139.82 | |
618 | \& <i WITH GRAVE> 236 88 88 88 195.172 139.83 | |
619 | \& <i WITH ACUTE> 237 85 85 85 195.173 139.84 | |
620 | \& <i WITH CIRCUMFLEX> 238 86 86 86 195.174 139.85 | |
621 | \& <i WITH DIAERESIS> 239 87 87 87 195.175 139.86 | |
622 | \& <SMALL LETTER eth> 240 140 140 140 195.176 139.87 | |
623 | \& <n WITH TILDE> 241 73 73 73 195.177 139.88 | |
624 | \& <o WITH GRAVE> 242 205 205 205 195.178 139.89 | |
625 | \& <o WITH ACUTE> 243 206 206 206 195.179 139.98 | |
626 | \& <o WITH CIRCUMFLEX> 244 203 203 203 195.180 139.99 | |
627 | \& <o WITH TILDE> 245 207 207 207 195.181 139.100 | |
628 | \& <o WITH DIAERESIS> 246 204 204 204 195.182 139.101 | |
629 | \& <DIVISION SIGN> 247 225 225 225 195.183 139.102 | |
630 | \& <o WITH STROKE> 248 112 112 112 195.184 139.103 | |
631 | \& <u WITH GRAVE> 249 221 221 192 195.185 139.104 ### | |
632 | \& <u WITH ACUTE> 250 222 222 222 195.186 139.105 | |
633 | \& <u WITH CIRCUMFLEX> 251 219 219 219 195.187 139.106 | |
634 | \& <u WITH DIAERESIS> 252 220 220 220 195.188 139.112 | |
635 | \& <y WITH ACUTE> 253 141 141 141 195.189 139.113 | |
636 | \& <SMALL LETTER thorn> 254 142 142 142 195.190 139.114 | |
637 | \& <y WITH DIAERESIS> 255 223 223 223 195.191 139.115 | |
638 | .Ve | |
639 | .PP | |
640 | If you would rather see the above table in \s-1CCSID\s0 0037 order rather than | |
641 | \&\s-1ASCII\s0 + Latin\-1 order then run the table through: | |
642 | .IP "recipe 4" 4 | |
643 | .IX Item "recipe 4" | |
644 | .PP | |
645 | .Vb 5 | |
646 | \& perl -ne 'if(/.{33}\ed{1,3}\es{6,8}\ed{1,3}\es{6,8}\ed{1,3}\es{6,8}\ed{1,3}/)'\e | |
647 | \& -e '{push(@l,$_)}' \e | |
648 | \& -e 'END{print map{$_->[0]}' \e | |
649 | \& -e ' sort{$a->[1] <=> $b->[1]}' \e | |
650 | \& -e ' map{[$_,substr($_,42,3)]}@l;}' perlebcdic.pod | |
651 | .Ve | |
652 | .PP | |
653 | If you would rather see it in \s-1CCSID\s0 1047 order then change the digit | |
654 | 42 in the last line to 51, like this: | |
655 | .IP "recipe 5" 4 | |
656 | .IX Item "recipe 5" | |
657 | .PP | |
658 | .Vb 5 | |
659 | \& perl -ne 'if(/.{33}\ed{1,3}\es{6,8}\ed{1,3}\es{6,8}\ed{1,3}\es{6,8}\ed{1,3}/)'\e | |
660 | \& -e '{push(@l,$_)}' \e | |
661 | \& -e 'END{print map{$_->[0]}' \e | |
662 | \& -e ' sort{$a->[1] <=> $b->[1]}' \e | |
663 | \& -e ' map{[$_,substr($_,51,3)]}@l;}' perlebcdic.pod | |
664 | .Ve | |
665 | .PP | |
666 | If you would rather see it in POSIX-BC order then change the digit | |
667 | 51 in the last line to 60, like this: | |
668 | .IP "recipe 6" 4 | |
669 | .IX Item "recipe 6" | |
670 | .PP | |
671 | .Vb 5 | |
672 | \& perl -ne 'if(/.{33}\ed{1,3}\es{6,8}\ed{1,3}\es{6,8}\ed{1,3}\es{6,8}\ed{1,3}/)'\e | |
673 | \& -e '{push(@l,$_)}' \e | |
674 | \& -e 'END{print map{$_->[0]}' \e | |
675 | \& -e ' sort{$a->[1] <=> $b->[1]}' \e | |
676 | \& -e ' map{[$_,substr($_,60,3)]}@l;}' perlebcdic.pod | |
677 | .Ve | |
678 | .SH "IDENTIFYING CHARACTER CODE SETS" | |
679 | .IX Header "IDENTIFYING CHARACTER CODE SETS" | |
680 | To determine the character set you are running under from perl one | |
681 | could use the return value of \fIord()\fR or \fIchr()\fR to test one or more | |
682 | character values. For example: | |
683 | .PP | |
684 | .Vb 2 | |
685 | \& $is_ascii = "A" eq chr(65); | |
686 | \& $is_ebcdic = "A" eq chr(193); | |
687 | .Ve | |
688 | .PP | |
689 | Also, \*(L"\et\*(R" is a \f(CW\*(C`HORIZONTAL TABULATION\*(C'\fR character so that: | |
690 | .PP | |
691 | .Vb 2 | |
692 | \& $is_ascii = ord("\et") == 9; | |
693 | \& $is_ebcdic = ord("\et") == 5; | |
694 | .Ve | |
695 | .PP | |
696 | To distinguish \s-1EBCDIC\s0 code pages try looking at one or more of | |
697 | the characters that differ between them. For example: | |
698 | .PP | |
699 | .Vb 2 | |
700 | \& $is_ebcdic_37 = "\en" eq chr(37); | |
701 | \& $is_ebcdic_1047 = "\en" eq chr(21); | |
702 | .Ve | |
703 | .PP | |
704 | Or better still choose a character that is uniquely encoded in any | |
705 | of the code sets, e.g.: | |
706 | .PP | |
707 | .Vb 4 | |
708 | \& $is_ascii = ord('[') == 91; | |
709 | \& $is_ebcdic_37 = ord('[') == 186; | |
710 | \& $is_ebcdic_1047 = ord('[') == 173; | |
711 | \& $is_ebcdic_POSIX_BC = ord('[') == 187; | |
712 | .Ve | |
713 | .PP | |
714 | However, it would be unwise to write tests such as: | |
715 | .PP | |
716 | .Vb 2 | |
717 | \& $is_ascii = "\er" ne chr(13); # WRONG | |
718 | \& $is_ascii = "\en" ne chr(10); # ILL ADVISED | |
719 | .Ve | |
720 | .PP | |
721 | Obviously the first of these will fail to distinguish most \s-1ASCII\s0 machines | |
722 | from either a \s-1CCSID\s0 0037, a 1047, or a POSIX-BC \s-1EBCDIC\s0 machine since \*(L"\er\*(R" eq | |
723 | chr(13) under all of those coded character sets. But note too that | |
724 | because \*(L"\en\*(R" is chr(13) and \*(L"\er\*(R" is chr(10) on the MacIntosh (which is an | |
725 | \&\s-1ASCII\s0 machine) the second \f(CW$is_ascii\fR test will lead to trouble there. | |
726 | .PP | |
727 | To determine whether or not perl was built under an \s-1EBCDIC\s0 | |
728 | code page you can use the Config module like so: | |
729 | .PP | |
730 | .Vb 2 | |
731 | \& use Config; | |
732 | \& $is_ebcdic = $Config{'ebcdic'} eq 'define'; | |
733 | .Ve | |
734 | .SH "CONVERSIONS" | |
735 | .IX Header "CONVERSIONS" | |
736 | .Sh "tr///" | |
737 | .IX Subsection "tr///" | |
738 | In order to convert a string of characters from one character set to | |
739 | another a simple list of numbers, such as in the right columns in the | |
740 | above table, along with perl's tr/// operator is all that is needed. | |
741 | The data in the table are in \s-1ASCII\s0 order hence the \s-1EBCDIC\s0 columns | |
742 | provide easy to use \s-1ASCII\s0 to \s-1EBCDIC\s0 operations that are also easily | |
743 | reversed. | |
744 | .PP | |
745 | For example, to convert \s-1ASCII\s0 to code page 037 take the output of the second | |
746 | column from the output of recipe 0 (modified to add \e\e characters) and use | |
747 | it in tr/// like so: | |
748 | .PP | |
749 | .Vb 17 | |
750 | \& $cp_037 = | |
751 | \& '\e000\e001\e002\e003\e234\e011\e206\e177\e227\e215\e216\e013\e014\e015\e016\e017' . | |
752 | \& '\e020\e021\e022\e023\e235\e205\e010\e207\e030\e031\e222\e217\e034\e035\e036\e037' . | |
753 | \& '\e200\e201\e202\e203\e204\e012\e027\e033\e210\e211\e212\e213\e214\e005\e006\e007' . | |
754 | \& '\e220\e221\e026\e223\e224\e225\e226\e004\e230\e231\e232\e233\e024\e025\e236\e032' . | |
755 | \& '\e040\e240\e342\e344\e340\e341\e343\e345\e347\e361\e242\e056\e074\e050\e053\e174' . | |
756 | \& '\e046\e351\e352\e353\e350\e355\e356\e357\e354\e337\e041\e044\e052\e051\e073\e254' . | |
757 | \& '\e055\e057\e302\e304\e300\e301\e303\e305\e307\e321\e246\e054\e045\e137\e076\e077' . | |
758 | \& '\e370\e311\e312\e313\e310\e315\e316\e317\e314\e140\e072\e043\e100\e047\e075\e042' . | |
759 | \& '\e330\e141\e142\e143\e144\e145\e146\e147\e150\e151\e253\e273\e360\e375\e376\e261' . | |
760 | \& '\e260\e152\e153\e154\e155\e156\e157\e160\e161\e162\e252\e272\e346\e270\e306\e244' . | |
761 | \& '\e265\e176\e163\e164\e165\e166\e167\e170\e171\e172\e241\e277\e320\e335\e336\e256' . | |
762 | \& '\e136\e243\e245\e267\e251\e247\e266\e274\e275\e276\e133\e135\e257\e250\e264\e327' . | |
763 | \& '\e173\e101\e102\e103\e104\e105\e106\e107\e110\e111\e255\e364\e366\e362\e363\e365' . | |
764 | \& '\e175\e112\e113\e114\e115\e116\e117\e120\e121\e122\e271\e373\e374\e371\e372\e377' . | |
765 | \& '\e134\e367\e123\e124\e125\e126\e127\e130\e131\e132\e262\e324\e326\e322\e323\e325' . | |
766 | \& '\e060\e061\e062\e063\e064\e065\e066\e067\e070\e071\e263\e333\e334\e331\e332\e237' ; | |
767 | .Ve | |
768 | .PP | |
769 | .Vb 2 | |
770 | \& my $ebcdic_string = $ascii_string; | |
771 | \& eval '$ebcdic_string =~ tr/\e000-\e377/' . $cp_037 . '/'; | |
772 | .Ve | |
773 | .PP | |
774 | To convert from \s-1EBCDIC\s0 037 to \s-1ASCII\s0 just reverse the order of the tr/// | |
775 | arguments like so: | |
776 | .PP | |
777 | .Vb 2 | |
778 | \& my $ascii_string = $ebcdic_string; | |
779 | \& eval '$ascii_string = tr/' . $cp_037 . '/\e000-\e377/'; | |
780 | .Ve | |
781 | .PP | |
782 | Similarly one could take the output of the third column from recipe 0 to | |
783 | obtain a \f(CW$cp_1047\fR table. The fourth column of the output from recipe | |
784 | 0 could provide a \f(CW$cp_posix_bc\fR table suitable for transcoding as well. | |
785 | .Sh "iconv" | |
786 | .IX Subsection "iconv" | |
787 | \&\s-1XPG\s0 operability often implies the presence of an \fIiconv\fR utility | |
788 | available from the shell or from the C library. Consult your system's | |
789 | documentation for information on iconv. | |
790 | .PP | |
791 | On \s-1OS/390\s0 or z/OS see the \fIiconv\fR\|(1) manpage. One way to invoke the iconv | |
792 | shell utility from within perl would be to: | |
793 | .PP | |
794 | .Vb 2 | |
795 | \& # OS/390 or z/OS example | |
796 | \& $ascii_data = `echo '$ebcdic_data'| iconv -f IBM-1047 -t ISO8859-1` | |
797 | .Ve | |
798 | .PP | |
799 | or the inverse map: | |
800 | .PP | |
801 | .Vb 2 | |
802 | \& # OS/390 or z/OS example | |
803 | \& $ebcdic_data = `echo '$ascii_data'| iconv -f ISO8859-1 -t IBM-1047` | |
804 | .Ve | |
805 | .PP | |
806 | For other perl based conversion options see the Convert::* modules on \s-1CPAN\s0. | |
807 | .Sh "C \s-1RTL\s0" | |
808 | .IX Subsection "C RTL" | |
809 | The \s-1OS/390\s0 and z/OS C run time libraries provide \fI_atoe()\fR and \fI_etoa()\fR functions. | |
810 | .SH "OPERATOR DIFFERENCES" | |
811 | .IX Header "OPERATOR DIFFERENCES" | |
812 | The \f(CW\*(C`..\*(C'\fR range operator treats certain character ranges with | |
813 | care on \s-1EBCDIC\s0 machines. For example the following array | |
814 | will have twenty six elements on either an \s-1EBCDIC\s0 machine | |
815 | or an \s-1ASCII\s0 machine: | |
816 | .PP | |
817 | .Vb 1 | |
818 | \& @alphabet = ('A'..'Z'); # $#alphabet == 25 | |
819 | .Ve | |
820 | .PP | |
821 | The bitwise operators such as & ^ | may return different results | |
822 | when operating on string or character data in a perl program running | |
823 | on an \s-1EBCDIC\s0 machine than when run on an \s-1ASCII\s0 machine. Here is | |
824 | an example adapted from the one in perlop: | |
825 | .PP | |
826 | .Vb 5 | |
827 | \& # EBCDIC-based examples | |
828 | \& print "j p \en" ^ " a h"; # prints "JAPH\en" | |
829 | \& print "JA" | " ph\en"; # prints "japh\en" | |
830 | \& print "JAPH\enJunk" & "\e277\e277\e277\e277\e277"; # prints "japh\en"; | |
831 | \& print 'p N$' ^ " E<H\en"; # prints "Perl\en"; | |
832 | .Ve | |
833 | .PP | |
834 | An interesting property of the 32 C0 control characters | |
835 | in the \s-1ASCII\s0 table is that they can \*(L"literally\*(R" be constructed | |
836 | as control characters in perl, e.g. \f(CW\*(C`(chr(0) eq "\ec@")\*(C'\fR | |
837 | \&\f(CW\*(C`(chr(1) eq "\ecA")\*(C'\fR, and so on. Perl on \s-1EBCDIC\s0 machines has been | |
838 | ported to take \*(L"\ec@\*(R" to \fIchr\fR\|(0) and \*(L"\ecA\*(R" to \fIchr\fR\|(1) as well, but the | |
839 | thirty three characters that result depend on which code page you are | |
840 | using. The table below uses the character names from the previous table | |
841 | but with substitutions such as s/START \s-1OF/S\s0.O./; s/END \s-1OF\s0 /E.O./; | |
842 | s/TRANSMISSION/TRANS./; s/TABULATION/TAB./; s/VERTICAL/VERT./; | |
843 | s/HORIZONTAL/HORIZ./; s/DEVICE \s-1CONTROL/D\s0.C./; s/SEPARATOR/SEP./; | |
844 | s/NEGATIVE \s-1ACKNOWLEDGE/NEG\s0. \s-1ACK\s0./;. The POSIX-BC and 1047 sets are | |
845 | identical throughout this range and differ from the 0037 set at only | |
846 | one spot (21 decimal). Note that the \f(CW\*(C`LINE FEED\*(C'\fR character | |
847 | may be generated by \*(L"\ecJ\*(R" on \s-1ASCII\s0 machines but by \*(L"\ecU\*(R" on 1047 or POSIX-BC | |
848 | machines and cannot be generated as a \f(CW"\ec.letter."\fR control character on | |
849 | 0037 machines. Note also that \*(L"\ec\e\e\*(R" maps to two characters | |
850 | not one. | |
851 | .PP | |
852 | .Vb 35 | |
853 | \& chr ord 8859-1 0037 1047 && POSIX-BC | |
854 | \& ------------------------------------------------------------------------ | |
855 | \& "\ec?" 127 <DELETE> " " ***>< | |
856 | \& "\ec@" 0 <NULL> <NULL> <NULL> ***>< | |
857 | \& "\ecA" 1 <S.O. HEADING> <S.O. HEADING> <S.O. HEADING> | |
858 | \& "\ecB" 2 <S.O. TEXT> <S.O. TEXT> <S.O. TEXT> | |
859 | \& "\ecC" 3 <E.O. TEXT> <E.O. TEXT> <E.O. TEXT> | |
860 | \& "\ecD" 4 <E.O. TRANS.> <C1 28> <C1 28> | |
861 | \& "\ecE" 5 <ENQUIRY> <HORIZ. TAB.> <HORIZ. TAB.> | |
862 | \& "\ecF" 6 <ACKNOWLEDGE> <C1 6> <C1 6> | |
863 | \& "\ecG" 7 <BELL> <DELETE> <DELETE> | |
864 | \& "\ecH" 8 <BACKSPACE> <C1 23> <C1 23> | |
865 | \& "\ecI" 9 <HORIZ. TAB.> <C1 13> <C1 13> | |
866 | \& "\ecJ" 10 <LINE FEED> <C1 14> <C1 14> | |
867 | \& "\ecK" 11 <VERT. TAB.> <VERT. TAB.> <VERT. TAB.> | |
868 | \& "\ecL" 12 <FORM FEED> <FORM FEED> <FORM FEED> | |
869 | \& "\ecM" 13 <CARRIAGE RETURN> <CARRIAGE RETURN> <CARRIAGE RETURN> | |
870 | \& "\ecN" 14 <SHIFT OUT> <SHIFT OUT> <SHIFT OUT> | |
871 | \& "\ecO" 15 <SHIFT IN> <SHIFT IN> <SHIFT IN> | |
872 | \& "\ecP" 16 <DATA LINK ESCAPE> <DATA LINK ESCAPE> <DATA LINK ESCAPE> | |
873 | \& "\ecQ" 17 <D.C. ONE> <D.C. ONE> <D.C. ONE> | |
874 | \& "\ecR" 18 <D.C. TWO> <D.C. TWO> <D.C. TWO> | |
875 | \& "\ecS" 19 <D.C. THREE> <D.C. THREE> <D.C. THREE> | |
876 | \& "\ecT" 20 <D.C. FOUR> <C1 29> <C1 29> | |
877 | \& "\ecU" 21 <NEG. ACK.> <C1 5> <LINE FEED> *** | |
878 | \& "\ecV" 22 <SYNCHRONOUS IDLE> <BACKSPACE> <BACKSPACE> | |
879 | \& "\ecW" 23 <E.O. TRANS. BLOCK> <C1 7> <C1 7> | |
880 | \& "\ecX" 24 <CANCEL> <CANCEL> <CANCEL> | |
881 | \& "\ecY" 25 <E.O. MEDIUM> <E.O. MEDIUM> <E.O. MEDIUM> | |
882 | \& "\ecZ" 26 <SUBSTITUTE> <C1 18> <C1 18> | |
883 | \& "\ec[" 27 <ESCAPE> <C1 15> <C1 15> | |
884 | \& "\ec\e\e" 28 <FILE SEP.>\e <FILE SEP.>\e <FILE SEP.>\e | |
885 | \& "\ec]" 29 <GROUP SEP.> <GROUP SEP.> <GROUP SEP.> | |
886 | \& "\ec^" 30 <RECORD SEP.> <RECORD SEP.> <RECORD SEP.> ***>< | |
887 | \& "\ec_" 31 <UNIT SEP.> <UNIT SEP.> <UNIT SEP.> ***>< | |
888 | .Ve | |
889 | .SH "FUNCTION DIFFERENCES" | |
890 | .IX Header "FUNCTION DIFFERENCES" | |
891 | .IP "\fIchr()\fR" 8 | |
892 | .IX Item "chr()" | |
893 | \&\fIchr()\fR must be given an \s-1EBCDIC\s0 code number argument to yield a desired | |
894 | character return value on an \s-1EBCDIC\s0 machine. For example: | |
895 | .Sp | |
896 | .Vb 1 | |
897 | \& $CAPITAL_LETTER_A = chr(193); | |
898 | .Ve | |
899 | .IP "\fIord()\fR" 8 | |
900 | .IX Item "ord()" | |
901 | \&\fIord()\fR will return \s-1EBCDIC\s0 code number values on an \s-1EBCDIC\s0 machine. | |
902 | For example: | |
903 | .Sp | |
904 | .Vb 1 | |
905 | \& $the_number_193 = ord("A"); | |
906 | .Ve | |
907 | .IP "\fIpack()\fR" 8 | |
908 | .IX Item "pack()" | |
909 | The c and C templates for \fIpack()\fR are dependent upon character set | |
910 | encoding. Examples of usage on \s-1EBCDIC\s0 include: | |
911 | .Sp | |
912 | .Vb 4 | |
913 | \& $foo = pack("CCCC",193,194,195,196); | |
914 | \& # $foo eq "ABCD" | |
915 | \& $foo = pack("C4",193,194,195,196); | |
916 | \& # same thing | |
917 | .Ve | |
918 | .Sp | |
919 | .Vb 2 | |
920 | \& $foo = pack("ccxxcc",193,194,195,196); | |
921 | \& # $foo eq "AB\e0\e0CD" | |
922 | .Ve | |
923 | .IP "\fIprint()\fR" 8 | |
924 | .IX Item "print()" | |
925 | One must be careful with scalars and strings that are passed to | |
926 | print that contain \s-1ASCII\s0 encodings. One common place | |
927 | for this to occur is in the output of the \s-1MIME\s0 type header for | |
928 | \&\s-1CGI\s0 script writing. For example, many perl programming guides | |
929 | recommend something similar to: | |
930 | .Sp | |
931 | .Vb 2 | |
932 | \& print "Content-type:\ettext/html\e015\e012\e015\e012"; | |
933 | \& # this may be wrong on EBCDIC | |
934 | .Ve | |
935 | .Sp | |
936 | Under the \s-1IBM\s0 \s-1OS/390\s0 \s-1USS\s0 Web Server or WebSphere on z/OS for example | |
937 | you should instead write that as: | |
938 | .Sp | |
939 | .Vb 1 | |
940 | \& print "Content-type:\ettext/html\er\en\er\en"; # OK for DGW et alia | |
941 | .Ve | |
942 | .Sp | |
943 | That is because the translation from \s-1EBCDIC\s0 to \s-1ASCII\s0 is done | |
944 | by the web server in this case (such code will not be appropriate for | |
945 | the Macintosh however). Consult your web server's documentation for | |
946 | further details. | |
947 | .IP "\fIprintf()\fR" 8 | |
948 | .IX Item "printf()" | |
949 | The formats that can convert characters to numbers and vice versa | |
950 | will be different from their \s-1ASCII\s0 counterparts when executed | |
951 | on an \s-1EBCDIC\s0 machine. Examples include: | |
952 | .Sp | |
953 | .Vb 1 | |
954 | \& printf("%c%c%c",193,194,195); # prints ABC | |
955 | .Ve | |
956 | .IP "\fIsort()\fR" 8 | |
957 | .IX Item "sort()" | |
958 | \&\s-1EBCDIC\s0 sort results may differ from \s-1ASCII\s0 sort results especially for | |
959 | mixed case strings. This is discussed in more detail below. | |
960 | .IP "\fIsprintf()\fR" 8 | |
961 | .IX Item "sprintf()" | |
962 | See the discussion of \fIprintf()\fR above. An example of the use | |
963 | of sprintf would be: | |
964 | .Sp | |
965 | .Vb 1 | |
966 | \& $CAPITAL_LETTER_A = sprintf("%c",193); | |
967 | .Ve | |
968 | .IP "\fIunpack()\fR" 8 | |
969 | .IX Item "unpack()" | |
970 | See the discussion of \fIpack()\fR above. | |
971 | .SH "REGULAR EXPRESSION DIFFERENCES" | |
972 | .IX Header "REGULAR EXPRESSION DIFFERENCES" | |
973 | As of perl 5.005_03 the letter range regular expression such as | |
974 | [A\-Z] and [a\-z] have been especially coded to not pick up gap | |
975 | characters. For example, characters such as o\*^ \f(CW\*(C`o WITH CIRCUMFLEX\*(C'\fR | |
976 | that lie between I and J would not be matched by the | |
977 | regular expression range \f(CW\*(C`/[H\-K]/\*(C'\fR. This works in | |
978 | the other direction, too, if either of the range end points is | |
979 | explicitly numeric: \f(CW\*(C`[\ex89\-\ex91]\*(C'\fR will match \f(CW\*(C`\ex8e\*(C'\fR, even | |
980 | though \f(CW\*(C`\ex89\*(C'\fR is \f(CW\*(C`i\*(C'\fR and \f(CW\*(C`\ex91 \*(C'\fR is \f(CW\*(C`j\*(C'\fR, and \f(CW\*(C`\ex8e\*(C'\fR | |
981 | is a gap character from the alphabetic viewpoint. | |
982 | .PP | |
983 | If you do want to match the alphabet gap characters in a single octet | |
984 | regular expression try matching the hex or octal code such | |
985 | as \f(CW\*(C`/\e313/\*(C'\fR on \s-1EBCDIC\s0 or \f(CW\*(C`/\e364/\*(C'\fR on \s-1ASCII\s0 machines to | |
986 | have your regular expression match \f(CW\*(C`o WITH CIRCUMFLEX\*(C'\fR. | |
987 | .PP | |
988 | Another construct to be wary of is the inappropriate use of hex or | |
989 | octal constants in regular expressions. Consider the following | |
990 | set of subs: | |
991 | .PP | |
992 | .Vb 4 | |
993 | \& sub is_c0 { | |
994 | \& my $char = substr(shift,0,1); | |
995 | \& $char =~ /[\e000-\e037]/; | |
996 | \& } | |
997 | .Ve | |
998 | .PP | |
999 | .Vb 4 | |
1000 | \& sub is_print_ascii { | |
1001 | \& my $char = substr(shift,0,1); | |
1002 | \& $char =~ /[\e040-\e176]/; | |
1003 | \& } | |
1004 | .Ve | |
1005 | .PP | |
1006 | .Vb 4 | |
1007 | \& sub is_delete { | |
1008 | \& my $char = substr(shift,0,1); | |
1009 | \& $char eq "\e177"; | |
1010 | \& } | |
1011 | .Ve | |
1012 | .PP | |
1013 | .Vb 4 | |
1014 | \& sub is_c1 { | |
1015 | \& my $char = substr(shift,0,1); | |
1016 | \& $char =~ /[\e200-\e237]/; | |
1017 | \& } | |
1018 | .Ve | |
1019 | .PP | |
1020 | .Vb 4 | |
1021 | \& sub is_latin_1 { | |
1022 | \& my $char = substr(shift,0,1); | |
1023 | \& $char =~ /[\e240-\e377]/; | |
1024 | \& } | |
1025 | .Ve | |
1026 | .PP | |
1027 | The above would be adequate if the concern was only with numeric code points. | |
1028 | However, the concern may be with characters rather than code points | |
1029 | and on an \s-1EBCDIC\s0 machine it may be desirable for constructs such as | |
1030 | \&\f(CW\*(C`if (is_print_ascii("A")) {print "A is a printable character\en";}\*(C'\fR to print | |
1031 | out the expected message. One way to represent the above collection | |
1032 | of character classification subs that is capable of working across the | |
1033 | four coded character sets discussed in this document is as follows: | |
1034 | .PP | |
1035 | .Vb 12 | |
1036 | \& sub Is_c0 { | |
1037 | \& my $char = substr(shift,0,1); | |
1038 | \& if (ord('^')==94) { # ascii | |
1039 | \& return $char =~ /[\e000-\e037]/; | |
1040 | \& } | |
1041 | \& if (ord('^')==176) { # 37 | |
1042 | \& return $char =~ /[\e000-\e003\e067\e055-\e057\e026\e005\e045\e013-\e023\e074\e075\e062\e046\e030\e031\e077\e047\e034-\e037]/; | |
1043 | \& } | |
1044 | \& if (ord('^')==95 || ord('^')==106) { # 1047 || posix-bc | |
1045 | \& return $char =~ /[\e000-\e003\e067\e055-\e057\e026\e005\e025\e013-\e023\e074\e075\e062\e046\e030\e031\e077\e047\e034-\e037]/; | |
1046 | \& } | |
1047 | \& } | |
1048 | .Ve | |
1049 | .PP | |
1050 | .Vb 4 | |
1051 | \& sub Is_print_ascii { | |
1052 | \& my $char = substr(shift,0,1); | |
1053 | \& $char =~ /[ !"\e#\e$%&'()*+,\e-.\e/0-9:;<=>?\e@A-Z[\e\e\e]^_`a-z{|}~]/; | |
1054 | \& } | |
1055 | .Ve | |
1056 | .PP | |
1057 | .Vb 9 | |
1058 | \& sub Is_delete { | |
1059 | \& my $char = substr(shift,0,1); | |
1060 | \& if (ord('^')==94) { # ascii | |
1061 | \& return $char eq "\e177"; | |
1062 | \& } | |
1063 | \& else { # ebcdic | |
1064 | \& return $char eq "\e007"; | |
1065 | \& } | |
1066 | \& } | |
1067 | .Ve | |
1068 | .PP | |
1069 | .Vb 16 | |
1070 | \& sub Is_c1 { | |
1071 | \& my $char = substr(shift,0,1); | |
1072 | \& if (ord('^')==94) { # ascii | |
1073 | \& return $char =~ /[\e200-\e237]/; | |
1074 | \& } | |
1075 | \& if (ord('^')==176) { # 37 | |
1076 | \& return $char =~ /[\e040-\e044\e025\e006\e027\e050-\e054\e011\e012\e033\e060\e061\e032\e063-\e066\e010\e070-\e073\e040\e024\e076\e377]/; | |
1077 | \& } | |
1078 | \& if (ord('^')==95) { # 1047 | |
1079 | \& return $char =~ /[\e040-\e045\e006\e027\e050-\e054\e011\e012\e033\e060\e061\e032\e063-\e066\e010\e070-\e073\e040\e024\e076\e377]/; | |
1080 | \& } | |
1081 | \& if (ord('^')==106) { # posix-bc | |
1082 | \& return $char =~ | |
1083 | \& /[\e040-\e045\e006\e027\e050-\e054\e011\e012\e033\e060\e061\e032\e063-\e066\e010\e070-\e073\e040\e024\e076\e137]/; | |
1084 | \& } | |
1085 | \& } | |
1086 | .Ve | |
1087 | .PP | |
1088 | .Vb 18 | |
1089 | \& sub Is_latin_1 { | |
1090 | \& my $char = substr(shift,0,1); | |
1091 | \& if (ord('^')==94) { # ascii | |
1092 | \& return $char =~ /[\e240-\e377]/; | |
1093 | \& } | |
1094 | \& if (ord('^')==176) { # 37 | |
1095 | \& return $char =~ | |
1096 | \& /[\e101\e252\e112\e261\e237\e262\e152\e265\e275\e264\e232\e212\e137\e312\e257\e274\e220\e217\e352\e372\e276\e240\e266\e263\e235\e332\e233\e213\e267\e270\e271\e253\e144\e145\e142\e146\e143\e147\e236\e150\e164\e161-\e163\e170\e165-\e167\e254\e151\e355\e356\e353\e357\e354\e277\e200\e375\e376\e373\e374\e255\e256\e131\e104\e105\e102\e106\e103\e107\e234\e110\e124\e121-\e123\e130\e125-\e127\e214\e111\e315\e316\e313\e317\e314\e341\e160\e335\e336\e333\e334\e215\e216\e337]/; | |
1097 | \& } | |
1098 | \& if (ord('^')==95) { # 1047 | |
1099 | \& return $char =~ | |
1100 | \& /[\e101\e252\e112\e261\e237\e262\e152\e265\e273\e264\e232\e212\e260\e312\e257\e274\e220\e217\e352\e372\e276\e240\e266\e263\e235\e332\e233\e213\e267\e270\e271\e253\e144\e145\e142\e146\e143\e147\e236\e150\e164\e161-\e163\e170\e165-\e167\e254\e151\e355\e356\e353\e357\e354\e277\e200\e375\e376\e373\e374\e272\e256\e131\e104\e105\e102\e106\e103\e107\e234\e110\e124\e121-\e123\e130\e125-\e127\e214\e111\e315\e316\e313\e317\e314\e341\e160\e335\e336\e333\e334\e215\e216\e337]/; | |
1101 | \& } | |
1102 | \& if (ord('^')==106) { # posix-bc | |
1103 | \& return $char =~ | |
1104 | \& /[\e101\e252\e260\e261\e237\e262\e320\e265\e171\e264\e232\e212\e272\e312\e257\e241\e220\e217\e352\e372\e276\e240\e266\e263\e235\e332\e233\e213\e267\e270\e271\e253\e144\e145\e142\e146\e143\e147\e236\e150\e164\e161-\e163\e170\e165-\e167\e254\e151\e355\e356\e353\e357\e354\e277\e200\e340\e376\e335\e374\e255\e256\e131\e104\e105\e102\e106\e103\e107\e234\e110\e124\e121-\e123\e130\e125-\e127\e214\e111\e315\e316\e313\e317\e314\e341\e160\e300\e336\e333\e334\e215\e216\e337]/; | |
1105 | \& } | |
1106 | \& } | |
1107 | .Ve | |
1108 | .PP | |
1109 | Note however that only the \f(CW\*(C`Is_ascii_print()\*(C'\fR sub is really independent | |
1110 | of coded character set. Another way to write \f(CW\*(C`Is_latin_1()\*(C'\fR would be | |
1111 | to use the characters in the range explicitly: | |
1112 | .PP | |
1113 | .Vb 4 | |
1114 | \& sub Is_latin_1 { | |
1115 | \& my $char = substr(shift,0,1); | |
1116 |