Re: Fedora C++ and locales

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----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-----




[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux