[xmonad] spawn functions are not unicode safe
sean.escriva at gmail.com
Wed Jan 14 18:58:02 EST 2009
On Wed, Jan 14, 2009 at 06:12:07PM -0500, Gwern Branwen wrote:
> -----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)?
whats the benefit to maintaining non unicode spawn behavior? is it
needlessly complex to have a spawnA and spawnU and then the actual
spawn function determines the more appropriate function to use based
on the string itself?
> - --
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
> -----END PGP SIGNATURE-----
> xmonad mailing list
> xmonad at haskell.org
More information about the xmonad