function string unicode_array_to_iso(long uni(), long mode_bits) ! ! unicode_array_to_iso88591() ! !======================================================================================================= ! title : unicode_array_to_iso_107.fun ! purpose: character data must be loaded into uni() before this function is called ! mode_bits% bit-0: 0 (relaxed - copy controls as-is) ! 1 (strict - change controls to a space; then compress) ! bit-1: 0 (relaxed - copy unmapped data as-is ! 1 (strict - change controls to a space; then compress) ! bit-4: 0 (debug off) ! 1 (debug on ) ! notes : 1) perhaps this function should be renamed unicode_array_to_iso88591() ! 2) no multi-byte characters are passed through this routine so if the destination ! database table defaults to utf-8 then you must use "character set latin1" in the ! "load data" command during the import into MySQL/MariaDB ! history: ! ver who when what ! --- --- -------- ------------------------------------------------------------------------------------- ! 107 NSR 20200106 1. derived from UNICODE_TO_ISO_106.FUN ! 2. added code to deal with 8246 (x2036) which has somehow crept into RMS bf_107.2 !======================================================================================================= option type=explicit ! ! declare string z ! declare long last,i,j,k,boggy ! !----------------------------------------------------------------------- ! main !----------------------------------------------------------------------- last = uni(0) ! for i = 1 to last ! select uni(i) ! case 0 to 31, 127 ! if (mode_bits and 1%) = 0% then ! z = z + chr$(uni(i)) ! relaxed - copy as-is else ! z = z + " " ! strict end if ! iterate ! case 32 to 126 ! z = z + chr$(uni(i)) ! iterate ! ! ! line-8 of the table ! case x'20ac' ! euro z = z + "$" ! case x'201a' ! z = z + "'" ! case x'0192' ! z = z + "f" ! case x'201e' ! z = z + '"' ! case x'2026' ! z = z + "..." ! case x'2020' ! z = z + "+" ! case x'2021' ! z = z + "+" ! case x'02c6' ! z = z + "^" ! case x'2030' ! z = z + "%" ! case x'0160' ! z = z + "S" ! case x'2039' ! z = z + "<" ! case x'0152' ! z = z + "OE" ! case x'017d' ! z = z + "Z" ! ! ! line-9 of the table ! case x'2018' ! z = z + "'" ! case x'2019' ! z = z + "'" ! case x'201c' ! z = z + '"' ! case x'201d' ! z = z + '"' ! case x'2022' ! z = z + "." ! case x'2013' ! z = z + "-" ! case x'2014' ! z = z + "-" ! case x'02dc' ! z = z + "~" ! case x'2122' ! z = z + "tm" ! case x'0161' ! z = z + "s" ! case x'203a' ! z = z + ">" ! case x'0153' ! z = z + "oe" ! case x'017e' ! z = z + "z" ! case x'0178' ! z = z + "Y" ! ! ! line-A of the table ! case x'00a0' ! z = z + " " ! case x'00a1' ! z = z + "!" ! case x'00a2' ! z = z + "c" ! case x'00a3' ! z = z + "$" ! case x'00a4' ! z = z + "." ! case x'00a5' ! z = z + "Y" ! case x'00a6' ! z = z + "|" ! case x'00a7' ! z = z + "S" ! case x'00a8' ! z = z + ".." ! case x'00a9' ! z = z + "(c)" ! case x'00aa' ! z = z + "a" ! case x'00ab' ! z = z + "<<" ! case x'00ac' ! z = z + "-" ! case x'00ad' ! z = z + "-" ! case x'00ae' ! z = z + "(r)" ! case x'00af' ! z = z + "-" ! ! ! line-B of the table ! case x'00b0' ! degree z = z + "o" ! case x'00b1' ! plus-minus z = z + "+-" ! case x'00b2' ! z = z + "2" ! case x'00b3' ! z = z + "3" ! case x'00b4' ! z = z + "'" ! case x'00b5' ! z = z + "u" ! case x'00b6' ! z = z + "q" ! case x'00b7' ! middle dot z = z + "." ! case x'00b8' ! z = z + "," ! cedilla case x'00b9' ! z = z + "1" ! case x'00ba' ! z = z + "o" ! case x'00bb' ! z = z + ">>" ! case x'00bc' ! z = z + "1/4" ! case x'00bd' ! z = z + "1/2" ! case x'00be' ! z = z + "3/4" ! case x'00bf' ! z = z + "?" ! ! ! line-C of the table ! case x'00c0' to x'00c5' ! z = z + "A" ! case x'00c6' ! z = z + "AE" ! case x'00c7' ! z = z + "C" ! case x'00c8' to x'00cb' ! z = z + "E" ! case x'00cc' to x'00cf' ! z = z + "I" ! ! ! line-D of the table ! case x'00d0' ! z = z + "D" ! case x'00d1' ! z = z + "N" ! case x'00d7' ! must before the next test ("O") z = z + "x" ! case x'00d2' to x'00d8' ! z = z + "O" ! case x'00d9' to x'00dc' ! z = z + "U" ! case x'00dd' ! z = z + "Y" ! case x'00de' ! z = z + "P" ! case x'00df' ! z = z + "B" ! ! ! line-E of the table ! case x'00e0' to x'00e5' ! z = z + "a" ! case x'00e6' ! z = z + "ae" ! case x'00e7' ! z = z + "c" ! case x'00e8' to x'00eb' ! z = z + "e" ! case x'00ec' to x'00ef' ! z = z + "i" ! ! ! line-F of the table ! case x'00f1' ! must before the next test ("o") z = z + "x" ! case x'00f7' ! must before the next test ("o") z = z + "/" ! case x'00f0' to x'00f8' ! z = z + "O" ! case x'00f9' to x'00fc' ! z = z + "u" ! case x'00fd' ! z = z + "y" ! case x'00fe' ! z = z + "p" ! case x'00ff' ! z = z + "y" ! ! ! boggies that have crept into RMS ! case x'2033' ! a.k.a. 8243 (double prime) z = z + '"' ! case x'2036' ! a.k.a. 8246 (reversed double prime) z = z + '"' ! ! ! catch all ! case else ! if (mode_bits and 2%) = 0% then ! select uni(i) ! case x'2000' to x'2FFF' ! z = z + chr$( int(uni(i)/256%) ) ! z = z + chr$( uni(i) and x'ff' ) ! end select ! else ! z = z + " " ! strict end if ! if (mode_bits and 4%) = 4% then ! boggy = 1 ! print "-d-unicode_array_to_iso:";i;" ";uni(i) ! sleep 1 ! end if ! end select ! next i ! ! z = edit$(z,128+16+8) ! trailing, multiple, leading print "-i-unicode_array_to_iso:"; z if boggy = 1 ! unicode_array_to_iso = z ! pass back to caller end function ! adios !
Back to OpenVMS
Back to OpenVMS Demo Index
Back to Home
Neil Rieck
Kitchener - Waterloo - Cambridge, Ontario, Canada.