Full colour emojis in virtual machine names in Fedora 27

Posted: December 1st, 2017 | Filed under: Coding Tips, Fedora, libvirt, OpenStack, Virt Tools | Tags: , , , , | 1 Comment »

Quite by chance today I discovered that Fedora 27 can display full colour glyphs for unicode characters that correspond to emojis, when the terminal displaying my mutt mail reader displayed someone’s name with a full colour glyph showing stars:

Mutt in GNOME terminal rendering color emojis in sender name

Chatting with David Gilbert on IRC I learnt that this is a new feature in Fedora 27 GNOME, thanks to recent work in the GTK/Pango stack. David then pointed out this works in libvirt, so I thought I would illustrate it.

Virtual machine name with full colour emojis rendered

No special hacks were required to do this, I simply entered the emojis as the virtual machine name when creating it from virt-manager’s wizard

Virtual machine name with full colour emojis rendered

As mentioned previously, GNOME terminal displays colour emojis, so these virtual machine names appear nicely when using virsh and other command line tools

Virtual machine name rendered with full colour emojis in terminal commands

The more observant readers will notice that the command line args have a bug as the snowman in the machine name is incorrectly rendered in the process listing. The actual data in /proc/$PID/cmdline is correct, so something about the “ps” command appears to be mangling it prior to output. It isn’t simply a font problem because other comamnds besides “ps” render properly, and if you grep the “ps” output for the snowman emoji no results are displayed.

One Response to “Full colour emojis in virtual machine names in Fedora 27”

  1. Dave Gilbert says:

    The ?’s are fun – an old old old Unix trick was to put escape characters in your command line to hide processes from an admin, so ps and the like sanitise the contents.

    A snowman is unfortunate enough to include a 9b character in it’s utf-8 encoding, and 9b is of course a top bit set 1b which is an Escape; and proc-ps-ng is paranoid enough to worry that some terminals get upset by it.
    The coffin is more complex; the coffin character used contains two separate characters, the coffin and a ‘variation selector 16’ – which basically says you want the coffin as an Emoji not as a plain character. proc-ps-ng hides any zero-width unicode characters, again because it’s difficult to know what chaos they might cause (e.g. it could be a r2l switch); so you end up losing the variation selector and get a plain coffin.

Leave a Reply





Spam protection: Sum of 0ne plus n1ne ?: