|
From: <tim...@en...> - 2006-04-17 16:12:31
|
> On Sunday 16 April 2006 08:35 pm, Timoth=C3=A9e Lecomte wrote: > >> I can implement the following : >> - if the user has used "set encoding ..." where "..." is something >> different from "default", the terminal converts from this encoding to >> utf8 >> - otherwise, use the 'locale' to determine the input charset, and assu= me >> this is the input encoding for the conversion to utf8. > > Or at the least, if 'locale' reports any flavor of utf8 then do not do > any conversion. > >> However, I am still not clear on one thing : >> If you launch the demo 'charset.dem' : >> - with the current code, the wxt terminal will show all characters as >> iso8859-1 encoded. > > Correct. > >> - with the new code falling back to the 'locale' charset, and if your >> locale charset is UTF-8, you won't see the last four lines [upper bit >> set] >> >> At the same time, the X11 terminal will show these lines !!! So my >> question is : what is the X11 terminal doing ?? > > The X terminal chooses an iso-8859-1 font by default unless you tell > it explicitly to use a multibyte font. If you say > set term x11 font "mbfont:verdana" > then as you predict, the last four lines of charset.dem are blank. > However, in this mode it handles utf-8 characters properly. Ok, I understand. I have implemented the behaviour described above : using the locale to determine the charset. I just added one other detail : when using the Symbol font, the terminal will assume you're using iso_8859_1, because you'll have to use non-utf8 characters. For example, in the demo, the integral character in \362, which is not a valid utf8 character. If the terminal tries to read the string in utf8, it would fail here and would not draw this character. > > I should add a "utf8.dem" as well. Good idea ! |