Using BB "colon code" to produce flags

Ideas and discussion


Post Reply
User avatar
MochiMoppel
Posts: 1236
Joined: Mon Jun 15, 2020 6:25 am
Location: Japan
Has thanked: 21 times
Been thanked: 439 times

Using BB "colon code" to produce flags

Post by MochiMoppel »

In follow-up to my recent post about undocumented "colon codes" and their pitfalls when editing forum posts, I tested more of these : ... : constructs.
In short: They are unpredictable and inconsistent.
Surprisingly there are some that may be useful. For some of the official 2-letter country codes as per ISO 3166 they can generate an associated country flag. Producing these flags per hand is a bit tricky because they are generated by joining 2 Unicode “regional indicator” letters. The colon codes could make this easy

Unfortunately only 11 of the official 247 country codes work as expected:
:cn: :cn:
:de: :de:
:es: :es:
:fr: :fr:
:it: :it:
:jp: :jp:
:kr: :kr:
:ru: :ru:
:tr: :tr:
:uk: :uk:
:us: :us:

These work, but not as expected:
:cd: :cd: Should be:🇨🇩 Congo (Dem. Rep.)
:cl: :cl: Should be:🇨🇱 Chile
:id: :id: Should be:🇮🇩 Indonesia
:ng: :ng: Should be:🇳🇬 Nigeria
:om: :om: Should be:🇴🇲 Oman
:sa: :sa: Should be:🇸🇦 Saudi Arabia
:tv: :tv: Should be:🇹🇻 Tuvalu

Not ISO 3166 compliant and not a country, but works
:eu: :eu:

Note that although the BB software converts the flag letters to SVG images (try to rightclick and open the image in new tab :lol: ), they behave pretty much like normal text. For example they can be enlarged with the usual BB code:
[size=200][size=200]:jp:[/size][/size] :jp:

User avatar
MochiMoppel
Posts: 1236
Joined: Mon Jun 15, 2020 6:25 am
Location: Japan
Has thanked: 21 times
Been thanked: 439 times

Re: Using BB "colon code" to produce flags

Post by MochiMoppel »

Update
Firstly to the unknown moderator who added "national flags" to my thread title (I changed it back):
- We had this discussion over and over again. Moderators should always leave a note when they make changes to someone's post. I don't understand why this still is not common practice on this board.
- ISO 3166 uses the term "country" codes. I try to stick to this terminology because I assume that there are differences between a country, a state and a nation . For example country code AQ Antarctica. A nation? Or SJ Svalbard & Jan Mayen. A nation?

MochiMoppel wrote: Sat Aug 03, 2024 2:15 am

These work, but not as expected:
:cd: :cd: Should be:🇨🇩 Congo (Dem. Rep.)
:cl: :cl: Should be:🇨🇱 Chile
:id: :id: Should be:🇮🇩 Indonesia
:ng: :ng: Should be:🇳🇬 Nigeria
:om: :om: Should be:🇴🇲 Oman
:sa: :sa: Should be:🇸🇦 Saudi Arabia
:tv: :tv: Should be:🇹🇻 Tuvalu

I found that in cases where 2-letter codes don't work, the country names often do:
:chile: :chile:
:indonesia: :indonesia:
:nigeria: :nigeria:
:oman: :oman:
:tuvalu: :tuvalu:

Some more:
:antarctica: :antarctica:
:greece: :greece:
:brazil: :brazil:
:taiwan: :taiwan:
:israel: :israel:
:palestine: :palestine: Like in real world. Doesn't work yet, though "PS Palestine" is already ISO compliant. Has to be input directly: 🇵🇸
:nauru: :nauru:
:liechtenstein: :liechtenstein:

When country names consist of multiple words, they have to be joined with a low line character:
:saudi_arabia: :saudi_arabia:
:papua_new_guinea: :papua_new_guinea:
:north_macedonia: :north_macedonia: :o BB software needs an update because :macedonia: :macedonia: still works and the Greeks will not like it :lol:

BTW: Congratulations to :st_lucia: :st_lucia: for its first ever Olympic :medal: :medal: :1f973: :1f973:

User avatar
greengeek
Posts: 1384
Joined: Thu Jul 16, 2020 11:06 pm
Has thanked: 535 times
Been thanked: 192 times

Re: Using BB "colon code" to produce flags

Post by greengeek »

Test from :new_zealand:

:thumbup:

ozsouth
Posts: 1569
Joined: Sun Jul 12, 2020 2:38 am
Location: S.E. Australia
Has thanked: 241 times
Been thanked: 704 times

Re: Using BB "colon code" to produce flags

Post by ozsouth »

:australia:

Had to use full name for Oz.

User avatar
rockedge
Site Admin
Posts: 6543
Joined: Mon Dec 02, 2019 1:38 am
Location: Connecticut,U.S.A.
Has thanked: 2749 times
Been thanked: 2624 times
Contact:

Re: Using BB "colon code" to produce flags

Post by rockedge »

Testing if I can do it! :de: :us:

d-pupp
Posts: 338
Joined: Tue Nov 22, 2022 9:11 pm
Location: Canada
Has thanked: 190 times
Been thanked: 52 times

Re: Using BB "colon code" to produce flags

Post by d-pupp »

:ca:
:canada:
The long form works for me.

User avatar
MochiMoppel
Posts: 1236
Joined: Mon Jun 15, 2020 6:25 am
Location: Japan
Has thanked: 21 times
Been thanked: 439 times

Re: Using BB "colon code" to produce flags

Post by MochiMoppel »

Every country's flag can be produced with colon code.

All (?) Puppies contain the text file /usr/share/zoneinfo/iso3166.tab, listing all official 2-letter ISO 3166 country codes and country names.
We have seen that sometimes the 2-letter code works in "colon code", very often the country name , but sometimes none of these methods do. E.g. how to generate the flag of CD Congo (Dem. Rep.) ?
There is a third method that always work. As demonstrated with the last emoticon of my last post it is possible to generate any smily/emoticon/symbol of the Twemoji font by enclosing its codepoint with colons: :1f383: :1f383:

To generate flags, we need 2 codepoints. "Regional indicator symbol" characters is a group of 26 4-byte Unicode characters depicting uppercaee characters A-Z. Each character is defined by a hexadecimal 5-digit codepoint:

Code: Select all

A = 1f1e6
B = 1f1e7
C = 1f1e8
D = 1f1e9
E = 1f1ea
F = 1f1eb
G = 1f1ec
H = 1f1ed
I = 1f1ee
J = 1f1ef
K = 1f1f0
L = 1f1f1
M = 1f1f2
N = 1f1f3
O = 1f1f4
P = 1f1f5
Q = 1f1f6
R = 1f1f7
S = 1f1f8
T = 1f1f9
U = 1f1fa
V = 1f1fb
W = 1f1fc
X = 1f1fd
Y = 1f1fe
Z = 1f1ff

To produce the CD flag we can now pick the codepoints tor C and for D from above list. Using them by their own they will produce "square" letters, maybe useful for buttons: :1f1e8: :1f1e8: :1f1e9: :1f1e9:, but combining them , in "colon code" done a with a hyphen, conveniently produces the flag associated with this country code:
:1f1e8-1f1e9: :1f1e8-1f1e9:

Apart from the ISO 3166 codes listed in the mentioned text files, there are a couple of ISO codes with a special status, e.g. "extended", and they also work:
AC Ascension Island
CP Clipperton Island
DG Diego Garcia
EA Ceuta, Melilla
EU European Union
IC Canary Islands
TA Tristan da Cunha
UN United Nations
XK Kosovo

I learned something. I always thought that the Canary Islands would use the Spanish flag (like Ceuta, Melilla), but they have their own: :canary_islands: :canary_islands: . I'm also surprised that :kosovo: :kosovo: is included although almost half of the UN member states don't recognize this country.

And then there is Great Britain and its subdivisions:
GB-ENG England
GB-NIR Northern Ireland
GB-SCT Scotland
GB-WLS Wales
These entities are constructed completely different and require not 2 but 7 codepoints, and not the ones in above list:
:1f3f4-e0067-e0062-e0073-e0063-e0074-e007f: :1f3f4-e0067-e0062-e0073-e0063-e0074-e007f:
Fortunately names work too:
:england: :england:
:scotland: :scotland:
:wales: :wales:

And where is Northern Ireland? :roll: Doesn't exist :lol: The Twemoji font used by BB simply doesn't contain this flag.
The flag is present in the NotoColorEmoji font, installed in BW64 and probably other Puppies. If installed the flag can be displayed with a script like this:

Code: Select all

#! /bin/bash
echo -n $'\U1F3F4\UE0067\UE0062\UE006E\UE0069\UE0072\UE007F' | gxmessage -fn 124 -file -
Post Reply

Return to “Forum Organization & Structure Council”