N.B.: You should e-mail the development list anyways, there are more people
there with many more skills than me. Don't worry about whether your question
is technically development or not. I'm just a guy in a hurry that hacks
stuff together to get my job done. XML is not a full time thing for me.
If you need it, you will have to write some kind of if / switch code that
checks for surrogate characters and converts them to their proper UTF-16
form, but this function will work for ASCII values. If you want a prettier
method that's international-safe, you need the ICU library from IBM or if
your UNIX/POSIX systems are, how shall I say it, 1337, the iconv system call
or GNU libiconv library can do this conversion stuff too.
HTH!
Matt
// widen function
// Converts ASCII std::string to XMLCh array.
// NOTE: Caller must delete XMLCh array when finished with it.
XMLCh* widen(const string& src)
{
// Allocate buffer.
XMLCh* dest = new XMLCh[src.length() + 1];
// Copy from string to buffer.
string::size_type i;
for (i=0; i < src.length(); ++i)
dest[i]=(XMLCh)src[i];
// Add NULL byte.
dest[i]=0;
// Return const pointer to array.
return dest;
}
-----Original Message-----
From: Matt Holmes [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 23, 2005 2:40 PM
To: [email protected]
Subject: RE: MemBufInputSource UTF-8 issue
I think we have that method named incorrectly which is causing some
confusion. It actually returns a wchar_t*, which is 16-bits on most systems.
Again, perhaps I am missing something here. How do I take the contents of my
std::wstring and pass them to the parser as UTF-16?
Matt
___________________________________________________________________
The information contained in this message and any attachment may be
proprietary, confidential, and privileged or subject to the work
product doctrine and thus protected from disclosure. If the reader
of this message is not the intended recipient, or an employee or
agent responsible for delivering this message to the intended
recipient, you are hereby notified that any dissemination,
distribution or copying of this communication is strictly prohibited.
If you have received this communication in error, please notify me
immediately by replying to this message and deleting it and all
copies and backups thereof. Thank you.