Perhaps with iconv API you could always force the input to the same
"regional setting" and thus only maintain one version of code?

Not sure, but it may be worth a try.


-----Original Message-----
 Subject: [C400-L] Local characters encoding problem

Having a very unpleasant problem with scrambled local characters in program
call input parameters.
Maybe someone can advise me of how to solve it.
PC program makes a call to a AS/400 program passing some parameters as a
unsigned char array, that is actually a packed structure. So it contains
bytes, some of which are actually chars, some are numbers. PC has always one
and the same local settings.
Probably my 3 AS/400 have different "regional settings". Result is that
depending on the particular machine I must use 3 different manually built
encoding tables.
We have only 8 local characters, so building this table itself is not a
problem. But the problem is managing 3 different versions of the same
program, that work on particular machine.
For exampl I have letter Ä (capital A with 2 dots above it) that comes to
one machine as 0x0A and to another machine as 0x24.
So on one machine I must have a code row :

for (i = 0; i < 20; i++)
  if (Buffer[i] == 0x0A) ;
    Buffer[i] = 'Ä' ;

and on another machine :
for (i = 0; i < 20; i++)
  if (Buffer[i] == 0x24) ;
    Buffer[i] = 'Ä' ;

Stupid, isn't it?! Is there a chance to find some proper AS/400 parameter,
may be some system variable or whatever, that can be tested in order to
select proper comparison right side?

Should say here, that I understand, that probably correct way is to take
care of this encoding is to push it to PC side, but this is not an option
for certain reasons...

Jevgeni Astanovski

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2019 by 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].