More Experiments with Xamarin.Forms Crossโ€‘Platform App Development in C# and Emoji

In my previous post I introduced a simple mobile game that I made with Xamarin.Forms. That was pretty basic but I have since made an improved version that I will cover in this post. I also learned far too much about emojis. ๐Ÿ˜€

Apart from giving you your time in seconds, the new version has a greater set of emoji to use. This means that each board is different every time you play it. I decided to limit the selection to country flags, although there is no intrinsic reason to restrict it to only this character set. It just keeps things simple, which I'll get into later.

Screenshot 1

Not all emoji are supported on all platforms (or platform versions). In the case of flags this fails quite gracefully and you get the two character country code. Other unsupported Unicode emoji all look the same as each other. Not great for a symbol matching game!

Screenshot 2

So, I simply removed all the unimplemented flags. I also dropped Monaco, as they have the same flag as Indonesia (so although the buttons look the same they don't match).

Here is the list of country codes I settled upon for targeting Android 6.0.1.

private readonly string[] flags =  
{
    "๐Ÿ‡ฆ๐Ÿ‡ฉ", "๐Ÿ‡ฆ๐Ÿ‡ช", "๐Ÿ‡ฆ๐Ÿ‡ซ", "๐Ÿ‡ฆ๐Ÿ‡ฌ", "๐Ÿ‡ฆ๐Ÿ‡ฎ", "๐Ÿ‡ฆ๐Ÿ‡ฑ", "๐Ÿ‡ฆ๐Ÿ‡ฒ", "๐Ÿ‡ฆ๐Ÿ‡ด", "๐Ÿ‡ฆ๐Ÿ‡ท", "๐Ÿ‡ฆ๐Ÿ‡ธ", "๐Ÿ‡ฆ๐Ÿ‡น", "๐Ÿ‡ฆ๐Ÿ‡บ", "๐Ÿ‡ฆ๐Ÿ‡ผ", "๐Ÿ‡ฆ๐Ÿ‡ฝ", "๐Ÿ‡ฆ๐Ÿ‡ฟ",
    "๐Ÿ‡ง๐Ÿ‡ฆ", "๐Ÿ‡ง๐Ÿ‡ง", "๐Ÿ‡ง๐Ÿ‡ฉ", "๐Ÿ‡ง๐Ÿ‡ช", "๐Ÿ‡ง๐Ÿ‡ซ", "๐Ÿ‡ง๐Ÿ‡ฌ", "๐Ÿ‡ง๐Ÿ‡ญ", "๐Ÿ‡ง๐Ÿ‡ฎ", "๐Ÿ‡ง๐Ÿ‡ฏ", "๐Ÿ‡ง๐Ÿ‡ฒ", "๐Ÿ‡ง๐Ÿ‡ณ", "๐Ÿ‡ง๐Ÿ‡ด", "๐Ÿ‡ง๐Ÿ‡ท", "๐Ÿ‡ง๐Ÿ‡ธ", "๐Ÿ‡ง๐Ÿ‡น", "๐Ÿ‡ง๐Ÿ‡ผ", "๐Ÿ‡ง๐Ÿ‡พ", "๐Ÿ‡ง๐Ÿ‡ฟ",
    "๐Ÿ‡จ๐Ÿ‡ฆ", "๐Ÿ‡จ๐Ÿ‡จ", "๐Ÿ‡จ๐Ÿ‡ฉ", "๐Ÿ‡จ๐Ÿ‡ซ", "๐Ÿ‡จ๐Ÿ‡ฌ", "๐Ÿ‡จ๐Ÿ‡ญ", "๐Ÿ‡จ๐Ÿ‡ฎ", "๐Ÿ‡จ๐Ÿ‡ฐ", "๐Ÿ‡จ๐Ÿ‡ฑ", "๐Ÿ‡จ๐Ÿ‡ฒ", "๐Ÿ‡จ๐Ÿ‡ณ", "๐Ÿ‡จ๐Ÿ‡ด", "๐Ÿ‡จ๐Ÿ‡ท", "๐Ÿ‡จ๐Ÿ‡บ", "๐Ÿ‡จ๐Ÿ‡ป", "๐Ÿ‡จ๐Ÿ‡ผ", "๐Ÿ‡จ๐Ÿ‡ฝ", "๐Ÿ‡จ๐Ÿ‡พ", "๐Ÿ‡จ๐Ÿ‡ฟ",
    "๐Ÿ‡ฉ๐Ÿ‡ช", "๐Ÿ‡ฉ๐Ÿ‡ฏ", "๐Ÿ‡ฉ๐Ÿ‡ฐ", "๐Ÿ‡ฉ๐Ÿ‡ฒ", "๐Ÿ‡ฉ๐Ÿ‡ด", "๐Ÿ‡ฉ๐Ÿ‡ฟ",
    "๐Ÿ‡ช๐Ÿ‡จ", "๐Ÿ‡ช๐Ÿ‡ช", "๐Ÿ‡ช๐Ÿ‡ฌ", "๐Ÿ‡ช๐Ÿ‡ท", "๐Ÿ‡ช๐Ÿ‡ธ", "๐Ÿ‡ช๐Ÿ‡น", "๐Ÿ‡ช๐Ÿ‡บ",
    "๐Ÿ‡ซ๐Ÿ‡ฎ", "๐Ÿ‡ซ๐Ÿ‡ฏ", "๐Ÿ‡ซ๐Ÿ‡ฒ", "๐Ÿ‡ซ๐Ÿ‡ด", "๐Ÿ‡ซ๐Ÿ‡ท",
    "๐Ÿ‡ฌ๐Ÿ‡ฆ", "๐Ÿ‡ฌ๐Ÿ‡ง", "๐Ÿ‡ฌ๐Ÿ‡ฉ", "๐Ÿ‡ฌ๐Ÿ‡ช", "๐Ÿ‡ฌ๐Ÿ‡ฌ", "๐Ÿ‡ฌ๐Ÿ‡ญ", "๐Ÿ‡ฌ๐Ÿ‡ฎ", "๐Ÿ‡ฌ๐Ÿ‡ฑ", "๐Ÿ‡ฌ๐Ÿ‡ฒ", "๐Ÿ‡ฌ๐Ÿ‡ณ", "๐Ÿ‡ฌ๐Ÿ‡ถ", "๐Ÿ‡ฌ๐Ÿ‡ท", "๐Ÿ‡ฌ๐Ÿ‡น", "๐Ÿ‡ฌ๐Ÿ‡บ", "๐Ÿ‡ฌ๐Ÿ‡ผ", "๐Ÿ‡ฌ๐Ÿ‡พ",
    "๐Ÿ‡ญ๐Ÿ‡ฐ", "๐Ÿ‡ญ๐Ÿ‡ณ", "๐Ÿ‡ญ๐Ÿ‡ท", "๐Ÿ‡ญ๐Ÿ‡น", "๐Ÿ‡ญ๐Ÿ‡บ",
    "๐Ÿ‡ฎ๐Ÿ‡ฉ", "๐Ÿ‡ฎ๐Ÿ‡ช", "๐Ÿ‡ฎ๐Ÿ‡ฑ", "๐Ÿ‡ฎ๐Ÿ‡ฒ", "๐Ÿ‡ฎ๐Ÿ‡ณ", "๐Ÿ‡ฎ๐Ÿ‡ด", "๐Ÿ‡ฎ๐Ÿ‡ถ", "๐Ÿ‡ฎ๐Ÿ‡ท", "๐Ÿ‡ฎ๐Ÿ‡ธ", "๐Ÿ‡ฎ๐Ÿ‡น",
    "๐Ÿ‡ฏ๐Ÿ‡ช", "๐Ÿ‡ฏ๐Ÿ‡ฒ", "๐Ÿ‡ฏ๐Ÿ‡ด", "๐Ÿ‡ฏ๐Ÿ‡ต",
    "๐Ÿ‡ฐ๐Ÿ‡ช", "๐Ÿ‡ฐ๐Ÿ‡ฌ", "๐Ÿ‡ฐ๐Ÿ‡ญ", "๐Ÿ‡ฐ๐Ÿ‡ฎ", "๐Ÿ‡ฐ๐Ÿ‡ฒ", "๐Ÿ‡ฐ๐Ÿ‡ณ", "๐Ÿ‡ฐ๐Ÿ‡ต", "๐Ÿ‡ฐ๐Ÿ‡ท", "๐Ÿ‡ฐ๐Ÿ‡ผ", "๐Ÿ‡ฐ๐Ÿ‡พ", "๐Ÿ‡ฐ๐Ÿ‡ฟ",
    "๐Ÿ‡ฑ๐Ÿ‡ฆ", "๐Ÿ‡ฑ๐Ÿ‡ง", "๐Ÿ‡ฑ๐Ÿ‡จ", "๐Ÿ‡ฑ๐Ÿ‡ฎ", "๐Ÿ‡ฑ๐Ÿ‡ฐ", "๐Ÿ‡ฑ๐Ÿ‡ท", "๐Ÿ‡ฑ๐Ÿ‡ธ", "๐Ÿ‡ฑ๐Ÿ‡น", "๐Ÿ‡ฑ๐Ÿ‡บ", "๐Ÿ‡ฑ๐Ÿ‡ป", "๐Ÿ‡ฑ๐Ÿ‡พ",
    "๐Ÿ‡ฒ๐Ÿ‡ฆ", "๐Ÿ‡ฒ๐Ÿ‡ฉ", "๐Ÿ‡ฒ๐Ÿ‡ช", "๐Ÿ‡ฒ๐Ÿ‡ฌ", "๐Ÿ‡ฒ๐Ÿ‡ญ", "๐Ÿ‡ฒ๐Ÿ‡ฐ", "๐Ÿ‡ฒ๐Ÿ‡ฑ", "๐Ÿ‡ฒ๐Ÿ‡ฒ", "๐Ÿ‡ฒ๐Ÿ‡ณ", "๐Ÿ‡ฒ๐Ÿ‡ด", "๐Ÿ‡ฒ๐Ÿ‡ต", "๐Ÿ‡ฒ๐Ÿ‡ท", "๐Ÿ‡ฒ๐Ÿ‡ธ", "๐Ÿ‡ฒ๐Ÿ‡น", "๐Ÿ‡ฒ๐Ÿ‡บ", "๐Ÿ‡ฒ๐Ÿ‡ป", "๐Ÿ‡ฒ๐Ÿ‡ผ", "๐Ÿ‡ฒ๐Ÿ‡ฝ", "๐Ÿ‡ฒ๐Ÿ‡พ", "๐Ÿ‡ฒ๐Ÿ‡ฟ",
    "๐Ÿ‡ณ๐Ÿ‡ฆ", "๐Ÿ‡ณ๐Ÿ‡ช", "๐Ÿ‡ณ๐Ÿ‡ซ", "๐Ÿ‡ณ๐Ÿ‡ฌ", "๐Ÿ‡ณ๐Ÿ‡ฎ", "๐Ÿ‡ณ๐Ÿ‡ฑ", "๐Ÿ‡ณ๐Ÿ‡ด", "๐Ÿ‡ณ๐Ÿ‡ต", "๐Ÿ‡ณ๐Ÿ‡ท", "๐Ÿ‡ณ๐Ÿ‡บ", "๐Ÿ‡ณ๐Ÿ‡ฟ",
    "๐Ÿ‡ด๐Ÿ‡ฒ",
    "๐Ÿ‡ต๐Ÿ‡ฆ", "๐Ÿ‡ต๐Ÿ‡ช", "๐Ÿ‡ต๐Ÿ‡ซ", "๐Ÿ‡ต๐Ÿ‡ฌ", "๐Ÿ‡ต๐Ÿ‡ญ", "๐Ÿ‡ต๐Ÿ‡ฐ", "๐Ÿ‡ต๐Ÿ‡ฑ", "๐Ÿ‡ต๐Ÿ‡ณ", "๐Ÿ‡ต๐Ÿ‡ท", "๐Ÿ‡ต๐Ÿ‡ธ", "๐Ÿ‡ต๐Ÿ‡น", "๐Ÿ‡ต๐Ÿ‡ผ", "๐Ÿ‡ต๐Ÿ‡พ",
    "๐Ÿ‡ถ๐Ÿ‡ฆ",
    "๐Ÿ‡ท๐Ÿ‡ด", "๐Ÿ‡ท๐Ÿ‡ธ", "๐Ÿ‡ท๐Ÿ‡บ", "๐Ÿ‡ท๐Ÿ‡ผ",
    "๐Ÿ‡ธ๐Ÿ‡ฆ", "๐Ÿ‡ธ๐Ÿ‡ง", "๐Ÿ‡ธ๐Ÿ‡จ", "๐Ÿ‡ธ๐Ÿ‡ฉ", "๐Ÿ‡ธ๐Ÿ‡ช", "๐Ÿ‡ธ๐Ÿ‡ฌ", "๐Ÿ‡ธ๐Ÿ‡ฎ", "๐Ÿ‡ธ๐Ÿ‡ฐ", "๐Ÿ‡ธ๐Ÿ‡ฑ", "๐Ÿ‡ธ๐Ÿ‡ฒ", "๐Ÿ‡ธ๐Ÿ‡ณ", "๐Ÿ‡ธ๐Ÿ‡ด", "๐Ÿ‡ธ๐Ÿ‡ท", "๐Ÿ‡ธ๐Ÿ‡ธ", "๐Ÿ‡ธ๐Ÿ‡น", "๐Ÿ‡ธ๐Ÿ‡ป", "๐Ÿ‡ธ๐Ÿ‡ฝ", "๐Ÿ‡ธ๐Ÿ‡พ", "๐Ÿ‡ธ๐Ÿ‡ฟ",
    "๐Ÿ‡น๐Ÿ‡จ", "๐Ÿ‡น๐Ÿ‡ฉ", "๐Ÿ‡น๐Ÿ‡ฌ", "๐Ÿ‡น๐Ÿ‡ญ", "๐Ÿ‡น๐Ÿ‡ฏ", "๐Ÿ‡น๐Ÿ‡ฐ", "๐Ÿ‡น๐Ÿ‡ฑ", "๐Ÿ‡น๐Ÿ‡ฒ", "๐Ÿ‡น๐Ÿ‡ณ", "๐Ÿ‡น๐Ÿ‡ด", "๐Ÿ‡น๐Ÿ‡ท", "๐Ÿ‡น๐Ÿ‡น", "๐Ÿ‡น๐Ÿ‡ป", "๐Ÿ‡น๐Ÿ‡ผ", "๐Ÿ‡น๐Ÿ‡ฟ",
    "๐Ÿ‡บ๐Ÿ‡ฆ", "๐Ÿ‡บ๐Ÿ‡ฌ", "๐Ÿ‡บ๐Ÿ‡ธ", "๐Ÿ‡บ๐Ÿ‡พ", "๐Ÿ‡บ๐Ÿ‡ฟ",
    "๐Ÿ‡ป๐Ÿ‡ฆ", "๐Ÿ‡ป๐Ÿ‡จ", "๐Ÿ‡ป๐Ÿ‡ช", "๐Ÿ‡ป๐Ÿ‡ฌ", "๐Ÿ‡ป๐Ÿ‡ฎ", "๐Ÿ‡ป๐Ÿ‡ณ", "๐Ÿ‡ป๐Ÿ‡บ",
    "๐Ÿ‡ผ๐Ÿ‡ธ",
    "๐Ÿ‡พ๐Ÿ‡ช",
    "๐Ÿ‡ฟ๐Ÿ‡ฆ", "๐Ÿ‡ฟ๐Ÿ‡ฒ", "๐Ÿ‡ฟ๐Ÿ‡ผ",
};

Note that these are not normal capital letters and there are two for each country (like UN TLDs). Many emoji are made from compounding multiple characters. However, even when it looks like there is only one character, treating Unicode code-points as literal characters will get you in trouble.

Emoji Woes

Unicode 9.0 emoji are - complex andโ€ฆ extensive. ๐Ÿ’ฉ ๐Ÿฉ

The level of support and how they look when rendered varies across platforms and even between different versions of those platforms. Google and Apple emojis look different, which is why WhatsApp uses Apple emojis on every platform. Try typing with the Android emoji keyboard into a chat (rather than the emoji button in the text field) to see this.

There is a big list of the differences here (WARNINGโ€ผ๏ธ - this is a big list and may hurt your browser). There is a lightweight plain text test set here.

Emojipedia is quite useful, although some of the pages are also rather heavyweight. Their blog highlights some of the differences for new versions of platforms, for example iOS 10, Android 7.0 Nougat and Windows 10 Anniversary Update.

In Windows 10 you can include emoji in your username (and password). For example, you could be a Ninja Cat riding a T-Rex (๐Ÿฑ๐Ÿ‰) or a Ninja Cat on a laptop (๐Ÿฑ๐Ÿ’ป). This may seem fun but will probably break things and won't seem so smart when you can't type it in. In much the same way, using emoji or diacritics in a WiFi SSID will break some clients, even though Zalgo text can be amusing.

I'll leave discussion of diacritics, internationalisation (i18n) and culture invariant comparisons to another day. It's almost as complicated as time-zones. However, as long as you stick to UTF-8 and accent/culture insensitive comparisons you should be fine.

Mac

In my next post I'll be covering how to work with .NET on a Mac. I will compare Xamarin Studio (soon to be Visual Studio for Mac) and VS Code.

Hopefully, it will soon be easy to write a complete solution using Xamarin for apps and ASP.NET Core for the supporting back-end web services. This should increase the potential code sharing and reuse opportunities even further.

P.S. I'm available for hire.

Submit / Comment on Hacker News