[xmonad] UTF-8 (Was: XMoBar Question)

Andrea Rossato mailing_list at istitutocolli.org
Thu Dec 20 08:46:29 EST 2007

Il Wed, Dec 19, 2007 at 02:06:35PM +0200, Roman Cheplyaka ebbe a scrivere:
> * Don Stewart <dons at galois.com> [2007-12-13 10:49:52-0800]
> > It should be easy to support uft8 (just use the utf8-string IO package).
> > We have utf8-friendly code in XMonadContrib, so I imagine it 
> > should be easy to add to xmobar if its missing.
> Not all the modules is utf8-friendly, e.g. Xmonad.Prompt.
> All I've found in XMC is 'decode' function in XMonad.Util.XSelection
> borrowed from utf8-string. Is 'decode' sufficient for Unicode support in
> other modules?

The issue is not so simple... First I'm reporting an answer I sent to
the original message at the beginning, message that I sent privately
for an error of mine...

---- original private msg -------
xmobar doesn't handle multi-byte character yet. it shouldn't be
difficult to do it, by the way. I'm really sorry but I've been
terribly busy in the last few days, and I think it is not going to be
better for another week or so (till the Christmas break (20 of
December for me): after that it will be hacking time!

And I'll take care of this issue too. If you want to have a try
yourself, it is just a matter of using a FontSet instead of a
FontStruct, and using XwcDrawImageString instead of XDrawImageString
(but I may be missing something right now). If you look in the list
archive I've sent some version of xprompt with wide character support
in the past. That could be used as an example.
---- end original msg -----------------------------

So, the same is true for every other module in xmonad: since we need
to talk to the xserver through xlib, we must call setlocale and use
locale aware functions (XwcDrawImageString, etc).

Then we can properly deal with the user locale (which can be utf-8).
AFAIR we do not need to specifically convert from a given locale,
since iconv can do everything for us - but I need to go back to when I
was doing that i18n work for xprompt and see if now I'm missing
something, which is actually quite probable at the present time. BTW,
as Don suggested, the Haskell part should be easy. The Xlib/C part a
bit less.

As I said originally, in the list archive there are some messages of
mine analyzing the issue. Maybe there are still useful, somehow.

Today it is my last lecture day. I'll have some more stuff to do
tomorrow, but after that I'll be back enjoying some Haskell hacking.
Moreover, now that the contrib extension is packaged as a library,
doing this i18n stuff should be relatively easier...;)

Hope this helps for now.


More information about the xmonad mailing list