print('\N{flag: Mauritius}') not supported in py3.9

dn PythonList at DancesWithMice.info
Sun Nov 28 16:08:29 EST 2021


On 29/11/2021 02.18, Chris Angelico wrote:
> On Mon, Nov 29, 2021 at 12:10 AM Abdur-Rahmaan Janhangeer
> <arj.python at gmail.com> wrote:
> 
> Flags are actually constructed from multiple codepoints. What you want
> is to insert each codepoint separately. You can see them listed in the
> second column of the table you linked to.
> 
>>>> "\U0001F1F2\U0001F1FA"
> '🇲🇺'
> 
> To do this with names, you need the names of those two codepoints:
> 
> '\U0001f1f2' REGIONAL INDICATOR SYMBOL LETTER M
> '\U0001f1fa' REGIONAL INDICATOR SYMBOL LETTER U
> 
>>>> "\N{REGIONAL INDICATOR SYMBOL LETTER M}\N{REGIONAL INDICATOR SYMBOL LETTER U}"
> '🇲🇺'


Don't use Emojis that often. The colored circles (U+1F534 etc) display
in full, glorious, technicolor.

However, when trying the above, with our local flag in (Fedora Linux,
Gnome) Terminal or PyCharm's Run terminal; the two letters "N" and "Z"
are shown with dotted-outlines. Similarly, the Mauritius' flag is shown
as "M" and "U".

Whereas here in email (Thunderbird) or in a web-browser, the flags
appear, as desired.

Is this a terminal short-coming (locale charmap -> UTF-8 - which brings
to mind the old UCS-4 questions), a font issue, or what (to fix)?
-- 
Regards,
=dn


More information about the Python-list mailing list