util icon indicating copy to clipboard operation
util copied to clipboard

Reverse broken for flag emoji

Open zacharysyoung opened this issue 2 years ago • 0 comments

Inspired by a comment on this SO about string-reversal in Python:

For example, "🇬🇧"[::-1] yields "🇧🇬".

I thought I'd try your Reverse() func:

assert.Equal(t, Reverse("🇬🇧"), "🇬🇧")

and I got:

Error Trace:	xstrings_test.go:86
    
Error:      	Not equal: 
    
                expected: "🇧🇬"
    
                actual  : "🇬🇧"
    
Test:       	TestReverse

Flags are special in that they are specific ordering of two letters to designate the ISO-3166 country code, which for some systems and fonts is rendered as that country's flag^1:

Regional indicator symbols These characters can be used in pairs to represent regional codes. In some emoji implementations, certain pairs may be recognized and displayed by alternate means; for instance, an implementation might recognize F + R and display this combination with a symbol representing the flag of France

zacharysyoung avatar Jun 14 '22 00:06 zacharysyoung