This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
std::wcout and non-ascii characters
- From: Matthias Wimmer <m at tthias dot net>
- To: libstdc++ at gcc dot gnu dot org
- Date: Thu, 9 Sep 2004 23:05:57 +0200
- Subject: std::wcout and non-ascii characters
Hello list!
Please pardon my post to this list, if there is a list, where I could
have better asked my question. But I already tried several days to
answer my question using Google and did not get any information on more
end-user discussions.
I have also seen that similar problems have been reported to your bug
database and have been closed as invalid, because the reporter did not
set a locale (but I did).
My problem is, that I try to use std::wcout and the other wide string
stuff in libstdc++. I isolated my problem and found out, that what seems
to be not working for me is std::wcout. My test code is the following:
>>>>>>
#include <iostream>
#include <locale>
#include <string>
int main() {
std::wcout.imbue(std::locale(""));
std::wstring myString(L"Liebe Grüße!");
std::wcout << myString << std::endl;
}
>>>>>>
When I compile and run this piece of code, I only get "Liebe Gr", not even
the line break is outputted.
I iterated over the wstring and it has all characters in it, also the
German letters. But if I try to output this wstring using wcout, the
output stops at the first non-ascii character.
I am using gcc 3.3.4 on a Debian Sid system, the user's default locale
is "de_DE.UTF-8". If I pipe the output of the test program from above
through hexdump, I see that the output is truncated at the first
non-ascii character and that it is no problem of my terminal.
Could someone please tell me what I am doing wrong?
Thanks in advance!
Matthias
--
Fon: +49-(0)70 0770 07770 http://web.amessage.info
HAM: DB1MW xmpp:mawis@amessage.info