You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by P M S Prakash <pr...@yahoo.com> on 2004/04/06 14:43:06 UTC

transcoding string with EUC-JP characters

Hi all,

How do I transcode string with EUC-JP characters?
Since XMLString::transcode does not support
non-english code pages, I wanted to use ICU
transcoder, I could not find any examples in using ICU
transcoding.

I tried to use UnicodeString to represent the japanese
string, but the XML transcoder does not accept this
datatype. 

UnicodeString str("&#12486;&#12473;&#12488;");

XMLCh* value = XMLString::transcode(str);

I could not find any ICU transcoder. Is there one? How
to use them.

Also, I am encoding an xml document using Base64
encoding, which returns XMLByte. How do I convert them
to char, as I need to send them to a web service thro'
soap.

Any inputs on this will be of great help.

Regards
Prakash

__________________________________
Do you Yahoo!?
Yahoo! Small Business $15K Web Design Giveaway 
http://promotions.yahoo.com/design_giveaway/

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


Re: transcoding string with EUC-JP characters

Posted by P M S Prakash <pr...@yahoo.com>.
Hi,


> That's not true; XMLString::transcode uses the local
> code page of your 
> machine, so if you are using a Japanese Unix machine
> with the correct code 
> page installed, it should just work.

When I tried to transcode, it was returning null. I
tried in couple of systems and found the same
behaviour. Also, in one of the sites, I read that it
does not support non-english character sets. So, I
thought I need to use either ICU or create a new
transcoder using XMLTransService.

Anyway, I will verify the system installation. Thanks
for the information.

> 
> Why are you creating a Unicode string to transcode
> into Unicode? If you 
> have an EUC-JP string you need a buffer like
> 
> char
>
str[]="\xC0\xEC\xCC\xE7\xB2\xC8\xA5\xE5\xA5\xB9\xA5\xC8";
> 

I was using RWCString. Since transcode was returning
null, I was trying to use UnicodeString.

> 
> Just cast the XMLByte* buffer to char*; XMLByte is
> simply a typedef for 
> unsigned char.

I will try that. 

Thanks for your help.

Regards
Prakash
> 
> Alberto
> 
> 
> >Any inputs on this will be of great help.
> >
> >Regards
> >Prakash
> >
> >__________________________________
> >Do you Yahoo!?
> >Yahoo! Small Business $15K Web Design Giveaway
> >http://promotions.yahoo.com/design_giveaway/
> >
>
>---------------------------------------------------------------------
> >To unsubscribe, e-mail:
> xerces-c-dev-unsubscribe@xml.apache.org
> >For additional commands, e-mail:
> xerces-c-dev-help@xml.apache.org
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail:
> xerces-c-dev-help@xml.apache.org
> 


__________________________________
Do you Yahoo!?
Yahoo! Small Business $15K Web Design Giveaway 
http://promotions.yahoo.com/design_giveaway/

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


Re: transcoding string with EUC-JP characters

Posted by Alberto Massari <am...@progress.com>.
At 05.43 06/04/2004 -0700, P M S Prakash wrote:
>Hi all,
>
>How do I transcode string with EUC-JP characters?
>Since XMLString::transcode does not support
>non-english code pages,

That's not true; XMLString::transcode uses the local code page of your 
machine, so if you are using a Japanese Unix machine with the correct code 
page installed, it should just work.

>I wanted to use ICU
>transcoder, I could not find any examples in using ICU
>transcoding.
>
>I tried to use UnicodeString to represent the japanese
>string, but the XML transcoder does not accept this
>datatype.
>
>UnicodeString str("&#12486;&#12473;&#12488;");
>
>XMLCh* value = XMLString::transcode(str);

Why are you creating a Unicode string to transcode into Unicode? If you 
have an EUC-JP string you need a buffer like

char str[]="\xC0\xEC\xCC\xE7\xB2\xC8\xA5\xE5\xA5\xB9\xA5\xC8";


>I could not find any ICU transcoder. Is there one? How
>to use them.

What do you mean with "any ICU transcoder"? ICU is a library that you can 
download from http://www-124.ibm.com/icu/ and it contains a lot of 
transcoders bundled inside it.

>Also, I am encoding an xml document using Base64
>encoding, which returns XMLByte. How do I convert them
>to char, as I need to send them to a web service thro'
>soap.

Just cast the XMLByte* buffer to char*; XMLByte is simply a typedef for 
unsigned char.

Alberto


>Any inputs on this will be of great help.
>
>Regards
>Prakash
>
>__________________________________
>Do you Yahoo!?
>Yahoo! Small Business $15K Web Design Giveaway
>http://promotions.yahoo.com/design_giveaway/
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
>For additional commands, e-mail: xerces-c-dev-help@xml.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org