Re: std::cout << Glib::ustring(utf8_literal) throws exception
- From: Sohail Somani <sohail taggedtype net>
- To: gtkmm-list gnome org
- Subject: Re: std::cout << Glib::ustring(utf8_literal) throws exception
- Date: Sun, 13 Jul 2008 20:14:55 -0700
Chris Vine wrote:
On Sun, 13 Jul 2008 15:17:31 -0700
However, why not convert your string to UTF-16 and output it that way
(using wcout)? I know very little about windows consoles (except of
course that UTF-16 is the worst of all possible choices), but I assume
wcout will handle a non-fixed size wide character set - the windows
console would be pretty useless if it didn't.
Alternatively, try switching to a decent OS which uses UTF-8 (narrow
codeset) and UCS-4 (fixed width wide codeset) - that is most modern
unix-like OSes.
Indeed, I believe I will have to use wcout after converting to UTF-16 on
Windows. But now the question is: what do I do to write portable code?
On Linux, simply std::cout << Glib::ustring(some_utf8_string) works just
fine.
I am wrapping Glib::ustring in my own string class so maybe the answer
is to always use wcout and overload operator<< for that class for
wostreams. This sounds very bad to me though.
The best answers encourage more questions ;-)
--
Sohail Somani
http://uint32t.blogspot.com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]