Convert ASCII 850 string into/from ISO 8859-1 (1004) string
[Autolink] Menu
/* ------------------------------------------------------------------ */
/* function: Convert an ASCII 850 string into an ISO 8859-1 */
/* (1004) string and vice versa */
/* */
/* call: PC_ISOB thisString, outP */
/* */
/* where: thisString - the string to convert */
/* outP - function code, either */
/* 1004 to convert to ISO */
/* or */
/* 850 to convert to ASCII */
/* */
/* output: the converted string */
/* */
/* Notes: Note that this not a complete codepage conversion. */
/* We only care about the letters. */
/* */
/* Author: Oliver Heidelbach (see EMail Addresses) */
/* */
PC_ISO: PROCEDURE
PARSE ARG thisString, outp
aISO = 'a1 a2 a3 bf c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 ca cb cc cd ce cf d0',
'd1 d2 d3 d4 d5 d6 d8 d9 da db dc dd de df e0 e1 e2 e3 e4 e5 e6',
'e7 e8 e9 ea eb ec ed ee ef f0 f1 f2 f3 f4 f5 f6 f8 f9 fa fb fc',
'fd fe ff'
aPC = 'ad bd 9c a8 b7 b5 b6 c7 8e 8f 92 80 d4 90 d2 d3 de d6 d7 d8 d1',
'a5 d2 d3 d4 e5 99 d8 eb e9 ea 9a ed e8 e1 85 a0 83 c6 84 86 91',
'87 8a 82 88 89 8d a1 8c 8b d0 a4 95 a2 93 e4 94 9b 97 a3 96 81',
'ec e7 98'
if outp = 1004 then
convbuf = Translate(thisString, X2C(aISO), X2C(aPC))
else
if outp = 850 then
convbuf = Translate(thisString, X2C(aPC), X2C(aISO))
RETURN convbuf
[Back: Formatting numbers]
[Next: Convert Microsoft/IEEE Float binary into a string in Classic REXX]