bug-ncurses
[Top][All Lists]
Advanced

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

Re: ncursesw + non-utf8 locales


From: Felix Natter
Subject: Re: ncursesw + non-utf8 locales
Date: Sat, 22 Oct 2011 12:15:00 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux)

Dennis Preiser <address@hidden> writes:

> Felix Natter <address@hidden> wrote:
>> I have attached a minimal example that includes the wideaddch() and
>> widen() helper functions I wrote. If you choose a ISO-8859-1 locale for
>> setlocale(), and switch gnome-terminal to Western (ISO-8859-15, which
>> should be compatible), then you see only garbage on the screen.
>> I guess this is to be expected when you try to output wchar_t (UTF-32?)
>> to a 8bit console.

hi Dennis,

> I guess you see the byte by byte representation of the utf-8 string.
>
> UTF-8:       a   ä      a   ä      ß       °      α      λ
> HEX:         61  c3 a4  61  c3 a4  c3 9f   c2 b0  ce b1  ce bb
> ISO-8859-1:  a   Ã  €   a   Ã  €   Ã  APC  Â  °   Î  ±   Î  »

Yes, that's exactly what I see, thanks for the detailed analysis!

>> But what can I do to fix this?
>
> The string needs to be converted in the current character set, e.g. with
> libiconv (UTF-8 -> ISO-8859-15 in your example).
>
> α and λ are not part of ISO-8859-15. You need a strategy for such
> characters. libiconv provides //IGNORE to simply skip those characters.

Thanks, this solution works fine!
-- 
Felix Natter




reply via email to

[Prev in Thread] Current Thread [Next in Thread]