Thanks but how do I get the UCS-2 data I receive in a normal string, in 
the C string. For example I receive '0049006E'. How do can I tell the   
I series this is really U'0049006E'??   

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Barbara Morris
Sent: maandag 13 juni 2005 23:35
To: rpg400-l@xxxxxxxxxxxx
Subject: Re: Problem converting unicode UCS-2 to character

kristof.anthonis@xxxxxx wrote:
> 
> I 'm having problems to find a way to convert a string containing
> unicode to normal characters.
> For examle I'm getting data '006E' and I want to translate this into
> character 'n'.
> I know if I declare the following;
> D X                         1C    inz(U'006E')
> X will contain 'n'.
> So the I-series is capable of doing so. But in this case '006E' is
> hard-coded. What about data
> wich I receive in stream??? How can I convert that?
> 

You can use %CHAR to convert from UCS-2 to character.

D X              s          1C    inz(U'006E')
D chr            s          1A

D stringC        s       5000C
D stringA        s       5000A   varying

      chr = %char(x)
      stringA = %char(%subst(stringC : 1 : numberOfUcs2Chars))

The number of Ucs2 chars is half the number of bytes.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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

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.