1

Toilet fails to print a euro sign. Since the pound sign does print, I was expecting that the Euro would as well. For some reason it doesn’t, though.

toilet -W -f georgia16 '£foo €bar'


   _____      __                           ___                         
  6MMMMMb    69MM                           MM                         
 6M'    Yb  6M' `                           MM                         
 MM        _MM__   _____     _____          MM____      ___    ___  __ 
 YM        MMMMM  6MMMMMb   6MMMMMb         MMMMMMb   6MMMMb   `MM 6MM 
 MM         MM   6M'   `Mb 6M'   `Mb        MM'  `Mb 8M'  `Mb   MM69 " 
MMMMMMMMM   MM   MM     MM MM     MM        MM    MM     ,oMM   MM'    
 MM         MM   MM     MM MM     MM        MM    MM ,6MM9'MM   MM     
 M9         MM   MM     MM MM     MM        MM    MM MM'   MM   MM     
69          MM   YM.   ,M9 YM.   ,M9        MM.  ,M9 MM.  ,MM   MM     
MMMMMMMMMM _MM_   YMMMMM9   YMMMMM9        _MYMMMM9  `YMMM9'Yb._MM_    

I’m using this font by xero harrison. The Euro sign can be found at line 1654.

128  EURO
           @
           @
    ____   @
   6MMMMb/$@
  8P    YM$@
 6M      Y$@
MMMMMMM/   @
 MM        @
 MM        @
MMMMM/     @
 YM      6$@
  8b    d9$@
   YMMMM9$ @
           @
           @
           @@

One restriction: default bash terminal on macos 10.12.

bash -version
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin16)
Copyright (C) 2007 Free Software Foundation, Inc.

Any pointers as to why and possibly a fix?

user2243670
  • 169
  • 4
  • toilet doesn't support unicode output as the homepage says: "TOIlet is in its very early development phase. It uses the powerful libcaca library to achieve various text-based effects. TOIlet implements or plans to implement the following features: The ability to load FIGlet fonts Support for Unicode input and output" – Ipor Sircer Dec 13 '17 at 14:06

1 Answers1

4

The font you’re using encodes the € symbol in position 128, which matches the Windows-1252 encoding. You need to convert your message into that character set before passing it to toilet:

echo '£foo €bar' | iconv -f UTF-8 -t Windows-1252 | toilet -W -f georgia16
Stephen Kitt
  • 411,918
  • 54
  • 1,065
  • 1,164
  • Thanks. If I need to lookup another match where should I look? Is there a way to check unicode mapping tables programmatically? – user2243670 Dec 13 '17 at 14:30
  • I’m the kind of scary person who just knows that € is 128 in 1252 (and 164 in 8859-15). There are probably tools which can help you figure that out (see `unicode` and `iconv`); another way is to explore Wikipedia, which has a lot of information on characters and encodings — *e.g.* for €, start at [Euro sign](https://en.wikipedia.org/wiki/Euro_sign) which leads to [Western Latin character sets (computing)](https://en.wikipedia.org/wiki/Western_Latin_character_sets_(computing)). – Stephen Kitt Dec 13 '17 at 14:54
  • Scary indeed. Ideally I’d need a programmatic lookup routine. I’ll post a new question about it. – user2243670 Dec 13 '17 at 15:11