So, I will probably only have to cast it to (WChar*).

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Friday, June 06, 2003 2:22 PM
To: [EMAIL PROTECTED]
Subject: RE: Convert XmlCh to wchar






Hi Fred,

If the conversion will always happen on a Windows machine, then you really
don't need to do anything.  wchar_t on Windows is UTF-16, so there's
nothing to convert.  If you're using a newer Microsoft compiler (7.0+),
then the types won't necessarily be compatible, so you'll have to copy and
cast the code points.

I'd like to see Xerces-C move to defining XMLCh as wchar_t on Windows, but
I don't know if or when that might happen.

Dave



                                                                                       
                                                   
                      "Fred Grafe"                                                     
                                                   
                      <[EMAIL PROTECTED]         To:      <[EMAIL PROTECTED]>          
                                           
                      oze.com>                 cc:      (bcc: David N 
Bertoni/Cambridge/IBM)                                              
                                               Subject: RE: Convert XmlCh to wchar     
                                                   
                      06/06/2003 11:13                                                 
                                                   
                      AM                                                               
                                                   
                      Please respond                                                   
                                                   
                      to xerces-c-dev                                                  
                                                   
                                                                                       
                                                   



Hi Dave,

WCHAR is of type wchar_t.  I think it is a Microsoft defined type.
Can you give me an example.  This is what I have

void DsapiSax2Handler::characters
(
const XMLCh* const pChars,
const unsigned int uiLength
)
{
printf("Number of chars = %d\n", uiLength);

for (unsigned int i = 0; i < uiLength; i++)
             {
             if (pChars[i] == 0)
                         {
                         printf("Breaking out of loop 1\n");
                         break;
                         }
             int ch = pChars[i];
             printf("pChars=%d\n", ch);
             }
}

I get the following dump:
pchars=72
pchars=105
pchars=26085

These are the correct values for "Hi?" (the ? is acting as a place holder
for
japanese character \u65e5).  Ultimately, all I want to do is pass this onto
a method
that is expecting WCHAR (or wchar_t).  How would a transcoder apply here?

fred

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Friday, June 06, 2003 2:00 PM
To: [EMAIL PROTECTED]
Subject: Re: Convert XmlCh to wchar






Hi Fred,

First of all, you'll need to know the encoding of the destination type.
What type is WCHAR?  If it's wchar_t, then the encoding is
system-dependent.  Once you know the encoding, then you'll need a
transcoder from UTF-16 to that encoding.

Dave




                      "Fred Grafe"

                      <[EMAIL PROTECTED]         To:
<[EMAIL PROTECTED]>

                      oze.com>                 cc:      (bcc: David N
Bertoni/Cambridge/IBM)
                                               Subject: Convert XmlCh to
wchar
                      06/06/2003 10:50

                      AM

                      Please respond

                      to xerces-c-dev





Hi

How can I convert a XMLCh* to a WCHAR*??

thanks
fred


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to