Fedora C++ and locales

Ulrich Drepper drepper at redhat.com
Tue Dec 16 01:17:57 UTC 2003


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Your program has one problem

>   char *src = "This is a öäåÖÄÅ test\n";

This isn't portable.  The string which should be stored in the binary is
encoded according to the locale the compiler is running with and maybe
even reading the string fails if the encoding of the file doesn't match.
 I actually don't know whether gcc enforces this.  In any case, it's
much better to use this:

char *src = "This is a \xc3\xb6\xc3\xa4\xc3\xa5\xc3\x96\xc3\x84\xc3\x85
test\n";

Anyway, even after this change I still see no output from this string.
If I use printf() instead it works, the conversion is successful.

I suggest you file a bug.

- -- 
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQE/3l1F2ijCOnn/RHQRAl+WAJ9yu6WrrJecWD3p3cEVCgHJetoJEgCfXRWc
JJq0Cy9gVB2jB/uLnDIJaw4=
=1OwD
-----END PGP SIGNATURE-----





More information about the fedora-list mailing list