[RndTbl] BruXy: Housenka – a game just in BASH

Adam Thompson athompso at athompso.net
Fri Feb 8 20:07:46 CST 2013


Dunno.  It just works out of the box for me.  I have LANG set to en-CA.UTF-8, in a terminal emulator set to expect UTF-8, using DejaVu Sans Mono as my font.
I'd hazard a guess that 'fixedsys' won't cut it for this :-).

...double-checking: yup, the script uses UTF-8 encoding and definitely contains UTF-8 characters.  You don't need to set LANG, but you will need a decent Unicode font (that contains line-drawing characters at the correct codepoints, which is a lot rarer than it should be!) and a terminal that can handle UTF-8 (which should include gnome-terminal without anything special required).

Interestingly, iconv(1) claims it's not well-formed UTF8 when it reaches the first U+2660, despite the fact that U+2660 is the (perfectly valid) Unicode codepoint for "Black Spade Suit".  You can use piconv(1) to see it in ASCII.  ("piconv -f en_CA.UTF-8 -t C -D -p < housenka.sh > housenka_ascii.sh")

Oh, the iconv(1) error is because there's no ASCII equivalent to translate U+2660 into.  Specifying the "to" charset as "ASCII//TRANSLIT" instead of just "ASCII" works, but sure is ugly!

The correct command then is "iconv -f UTF8 -t ASCII//TRANSLIT < housenka.sh > hous_asc.sh", which does work correctly and is actually playable, even using "fixedsys" as the font.

-Adam Thompson
 athompso at athompso.net


> -----Original Message-----
> From: roundtable-bounces at muug.mb.ca [mailto:roundtable-
> bounces at muug.mb.ca] On Behalf Of Trevor Cordes
> Sent: Friday, February 8, 2013 1:58 PM
> To: roundtable at muug.mb.ca
> Subject: Re: [RndTbl] BruXy: Housenka – a game just in BASH
> 
> On 2013-02-06 Adam Thompson wrote:
> > http://bruxy.regnet.cz/web/linux/EN/housenka-bash-game/
> >
> > Who says shell scripting has to be terribly painful?  The code is
> > actually quite readable.  I especially like the use of the
> subshell to
> > trigger SIGALRM, I would never have thought of that myself.
> 
> What's surprising is how short the script is.
> 
> Anyhow, it doesn't work on my box.  I'm guessing it's a unicode
> thing.
> What should LANG be?  What terminal program do I need to use (it's
> not working in gnome-terminal as the site says)?  What font?  What
> else?
> _______________________________________________
> Roundtable mailing list
> Roundtable at muug.mb.ca
> http://www.muug.mb.ca/mailman/listinfo/roundtable




More information about the Roundtable mailing list