[xsd-users] non english characters

Boris Kolpackov boris at codesynthesis.com
Sat Dec 30 12:09:27 EST 2006


Hi Remsy,

Remsy Schmilinsky <rschmilinsky at yahoo.ca> writes:

> Hi. I modifed hello.xml to test the parsing of strings containing
> accented characters however these strings are not being displayed
> when running driver.cxx.
>
> I'm using linux ubuntu "edgy".
>
> It works fine under cygwin. Furthermore, I have no problem printing
> accented characters to the console from a simple "hello world" c++
> application (std::string).
>
> xsd uses UTF-8 by default too? Is there something I can do to fix it?

For 8-bit characters (char), XSD uses current locale/code page for
encoding. On POSIX systems you can set the locale with the setlocale
function, as the following sample shows for UTF-8:


#include <clocale>
#include <iostream>

int
main ()
{
  if (!std::setlocale (LC_CTYPE, "en_US.UTF-8"))
  {
    std::cerr << "en_US.UTF-8 locale is not supported" << std::endl;
    return 1;
  }

  ...
}


The advantage of this approach lies in the fact that the same character
encoding is now assumed by the resulting in-memory representation and
the string/character manipulation functions provided by the language
runtime.


hth,
-boris
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 652 bytes
Desc: Digital signature
Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20061230/407a1efd/attachment.pgp


More information about the xsd-users mailing list