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]

Reply via email to