Reputation: 3639
I have a number of string literals in my C# that include unicode characters. We are using these to send Push Notifications via Azure Notifcations Hub.
When I send one of the strings in this first set below the notification renders with the expected text and emoticon.
Any of the ones in the set below do appear as Push Notifcations but the special symbols, green circle, amber circle and red circle do not. I'll try and grab a screen shot and reedit this
I notice that VS 2022 does not fully highlight the escaped unicode strings that do not work and they all have an escape sequence length greater than 5 chars but that fact is likely a red herring. Here is the VS2022 rendering
Note the text "...Amber, \u1f7e1 Tap for more". This is how that is rendered in a Push Notification
Note the "1" after the supposed symbol
Upvotes: 0
Views: 406
Reputation: 3639
The reason that my unicode characters were not displaying correctly was that I was not escaping them properly in the C# string literal.
26A1 is an example of the strings that were displaying correctly. This string is from the UTF16 range and can be escaped with the escape sequence starting "\u", note the lower case "u".
1F7E2 is an example of the strings that were not displaying correctly. I naively copied the earlier escape sequence and just changed the characters to be escaped. However this unicode string is from the UTF32 range and needs a different escape sequence, the uppercase u, "\U" making the string literal "Signal is Green. \U0001F7E2 Tap for more.
" Note the leading zeroes too.
References that I found useful were
Upvotes: 1