[xmonad] spawn functions are not unicode safe

Gwern Branwen gwern0 at gmail.com
Wed Jan 14 18:12:07 EST 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

On Wed, Jan 14, 2009 at 5:46 PM, Khudyakov Alexey  wrote:
> Hello.
>
> There is problem with `spawn' function as well with *spawn family from
> XMonad.Util.Run. They mangle unicode symbols which are passed to them. This
> is because they make use of `executeFile' which silently truncate each letter
> to one byte.
>
> Simplest workaround is to use utf8-string package. It would work only on
> systems with UTF8 locales but now they are majority I hope.
>
>> import Codec.Binary.UTF8.String
>> -- | Unicode safe spawn
>> spawnU :: MonadIO m => String -> m ()
>> spawnU = spawn . encodeString
>
> The same possible for all *spawn functions. I think it's worth to include
> unicodified versions to XMonadContrib but not sure is there anyone who need
> such functionality

I think it's worth including such functionality (especially as we
already depend on utf8-string in XMC). I often run Wikipedia & Google
searches on terms which include accents and other such UTFy things,
and it's a little tiresome fixing the search. Likely they are coming
pre-mangled by X, but if the spawn functions are also guilty then this
would at least be a step further.

That said, it's also worth asking where this should be done. Do we
leave XMonad core alone, and provide spawnU in XMC (and rewrite the
~53 XMC calls to call spawnU)?

- --
gwern
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEAREKAAYFAklucUUACgkQvpDo5Pfl1oLhfQCgiKEq+7pq11MwIzke7bRdbWg2
Sh4AnjwIBAuvDnWMmNSq0v9Jv0GcEhgL
=O9tZ
-----END PGP SIGNATURE-----


More information about the xmonad mailing list