|
There is a code page API which I posted below. The hardest part is getting the right to/from code pages. Have fun. Christopher K. Bipes mailto:ChrisB@Cross-Check.com Sr. Programmer/Analyst mailto:Chris_Bipes@Yahoo.com CrossCheck, Inc. http://www.cross-check.com 6119 State Farm Drive Phone: 707 586-0551 x 1102 Rohnert Park CA 94928 Fax: 707 586-1884 *Note to Recruiters Neither I, nor anyone that I know of, is interested in any new and/or exciting positions. Please do not contact me. -----Original Message----- From: Howard Weatherly [mailto:hweatherly@dlis.dla.mil] Sent: Tuesday, November 16, 1999 5:49 AM To: MML Subject: Code Page We have a situation where some folks out of the country send data in thru a web application. When the data arrives here it has upper ascii characters "mit der umlaut" etc... I believe that the code page would help here, but do not know if the sender is responsible or not. Actually it does not matter if the sender is or is not, we need to convert this stuff to our code set. Anyone have any ideas on how to do this? *********************** CODE PAGE API ********************************** *------------------------------------------------------------------ * Prototype for Code Conversion - Open *------------------------------------------------------------------ d IConvOpen PR 52A ExtProc('QtqIconvOpen') d * Value options(*string) To Code d * Value options(*string) Fr Code *------------------------------------------------------------------ * Prototype for Code Conversion *------------------------------------------------------------------ d IConv PR 10i 0 ExtProc('iconv') d 52a Value Code Discripter d * Value ptr to InBuffer Ptr d * Value ptr to InSize ptr d * Value ptr to OutBuffer Ptr d * Value ptr to OutSize ptr **************************************************************** * Code Page Conversions (iconv_t) ***************************************************************** d ToAscii DS d ICORV_A 1 4b 0 * return value to indicate if error occurred d ICOC_A 5 52b 0 DIM(00012) * cd * d ToEbcdic DS d ICORV_E 1 4b 0 * return value to indicate if error occurred d ICOC_E 5 52b 0 DIM(00012) * cd * * d p_Qascii S * inz(%addr(Qascii)) d Qascii DS 32 d asciiCP 1 4b 0 inz(00813) Code page ID d asciiCA 5 8b 0 inz(0) d asciiSA 9 12b 0 inz(0) d asciiSS 13 16b 0 inz(1) d asciiIL 17 20b 0 inz(0) d asciiEO 21 24b 0 inz(1) d asciiR 25 32a inz(*allx'00') * d p_Qebcdic S * inz(%addr(Qebcdic)) d Qebcdic DS 32 d ebcdicCP 1 4b 0 inz(00037) Code page ID d ebcdicCA 5 8b 0 inz(0) d ebcdicSA 9 12b 0 inz(0) d ebcdicSS 13 16b 0 inz(1) d ebcdicIL 17 20b 0 inz(0) d ebcdicEO 21 24b 0 inz(1) d ebcdicR 25 32a inz(*allx'00') * * translate response to ASCII c eval p_InBuff = %addr(TXTIN) c eval p_OutBuff = %addr(TXTOUT) c eval InBytesLeft = %len(%trim(TXTIN)) c eval OutBytesLeft = %len(TXTOUT) c eval rc = IConv(ToAscii: c %addr(p_InBuff): c p_InBytes: c %addr(p_OutBuff): c p_OutBytes) c if ICORV_A > 0 c eval MsgToDsply = 'Error in Translate' c MsgToDsply dsply c endif * translate to ebcdic c eval p_InBuff = %addr(TXTIN) c eval p_OutBuff = %addr(TXTOUT) c eval InBytesLeft = %len(%trim(TXTIN)) c eval OutBytesLeft = %len(TXTOUT) c eval rc = IConv(ToEbcdic: c %addr(p_InBuff): c p_InBytes: c %addr(p_OutBuff): c p_OutBytes) c if ICORV_E > 0 c eval MsgToDsply = 'Error in Translate' c MsgToDsply dsply c endif * ************************************************************************** * FIRST PASS ************************************************************************** csr *INZSR begsr * setup code page conversion ebcdic - ascii c eval ToAscii = IConvOpen(p_Qascii: c p_Qebcdic) c if ICORV_A = -1 * error processing here c endif * setup code page conversion ascii - ebcdic c eval ToEbcdic = IConvOpen(p_Qebcdic: c p_Qascii) c if ICORV_E = -1 * error processing here c endif * csr #INZSR endsr +--- | This is the Midrange System Mailing List! | To submit a new message, send your mail to MIDRANGE-L@midrange.com. | To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com. | To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.