|
I was actually referring to making it "work" on V4R5 and up, so doing it one way for all versions. I can set the code page but what about machines running V5R1 and up?
There are lots of potential solutions, but I don't know enough about yoru project to recommend one. Here are thoughts:
a) Store the CCSID in the data of the file itself (assuming you can do that without fouling up another application). For example, store it in the first 2 bytes of the file. Use the open() API in binary mode, and do the translation with the iconv() API. This'll work on any release.
b) If you can't store the CCSID in the file itself, can you just "assume" that a V4R5 file will always be in a particular CCSID? So iconv() always assumes a particular CCSID, rather than looking at what the file is tagged with?
c) Perhaps always store the data in Unicode, and just use iconv() when it needs to be translated for displaying it to a user? Then the file's CCSID can be assumed to be the unicode CCSID at all times, and only the job's CCSID has to be looked up.
what code page do I use? I can't find a table anywhere that has a cross reference from Code pages to CCSIDs.
Hmmm... can't a CCSID refer to more than one codepage? I didn't think it was a simple 1 to 1 mapping. Have you looked at the NLS APIs (link follows):
http://publib.boulder.ibm.com/infocenter/iseries/v5r3/topic/apis/nls1.htmThere's an API that gets a CS/CP (character set / code page) pair from a given CCSID, and vice-versa.
There's a lot of stuff out there, but nothing that's nearly as elegant as the V5R1 support.
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.