This is what I finally got to work. Thanks for the help. I'm not sure if
XMLString::stringLen is the right way to get the string's length, but it
seems to work well.
XMLPlatformUtils::Initialize();
XMLTransService::Codes resCode;
transcoder =
XMLPlatformUtils::fgTransService->makeNewTranscoderFor("ISO-8859-1",
resCode, 8192);
XMLByte bufToFill[8192];
unsigned int bytesEaten;
const XMLTranscoder::UnRepOpts unRepOpts = XMLTranscoder::UnRep_Throw;
transcoder->transcodeTo(toTranscode, (unsigned
int)XMLString::stringLen(toTranscode), bufToFill, 8192, bytesEaten,
unRepOpts);
fLocalForm = (char*)calloc(bytesEaten+1,1 );
strncpy(fLocalForm, (char*)bufToFill, bytesEaten);
cout << fLocalForm << endl;
-Jeremy
-----Original Message-----
From: Dean Roddey [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 04, 2001 12:23 PM
To: '[EMAIL PROTECTED]'
Subject: RE: Transcoding help
Does it report any bytes eaten?
--------------
Dean Roddey
Software Geek Extraordinaire
Portal, Inc
[EMAIL PROTECTED]
-----Original Message-----
From: Jeremy Sheeley [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 04, 2001 8:15 AM
To: [EMAIL PROTECTED]
Subject: Transcoding help
I'm still struggling trying to figure this transcoding stuff out.
Given and XMLCh* toTranscode (which was in ISO8859-1 when it was read in) I
want to print out the ISO8859-1 encoding of that string.
I do something like this:
XMLPlatformUtils::Initialize();
XMLTransService::Codes resCode;
transcoder =
XMLPlatformUtils::fgTransService->makeNewTranscoderFor("ISO-8859-1",
resCode, 8192);
XMLByte bufToFill[8192];
unsigned int bytesEaten;
const XMLTranscoder::UnRepOpts unRepOpts = XMLTranscoder::UnRep_Throw;
transcoder->transcodeTo(toTranscode, (unsigned int)1, bufToFill, 8192,
bytesEaten, unRepOpts);
fLocalForm = (char*)malloc(bytesEaten + 1);
strncpy(fLocalForm, (char*)bufToFill, bytesEaten);
cout << fLocalForm << endl;
That chunk of code should only take the first character of toTranscode and
send that to bufToFill as an ISO8859-1 string. I then copy that string into
a regular unsigned char*. I know I'm doing something wrong because all I
get is garbage and no exception thrown. Any and all help would be
appreciated.
Jeremy Sheeley
---------------------------------------------------------------------
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]