Recent

Author Topic: [Solved] Convert surrogate-pair chars to Unicode number?  (Read 316 times)

AlexTP

  • Hero Member
  • *****
  • Posts: 2118
    • UVviewsoft
[Solved] Convert surrogate-pair chars to Unicode number?
« on: March 18, 2023, 11:44:59 am »
I have 2 surrogate-pair chars, e.g. ch and ch2 (WideChar).
I know that they are from Emoji, e.g. this:
https://www.compart.com/en/unicode/U+1F9B0

How can I convert these 2 chars to Unicode index 1F9B0 ?

I tried: storing ch+ch2 to a UTF8string, then calling UTF8CharacterToUnicode. It is not OK result, it gives code of 'ch' only.
« Last Edit: March 18, 2023, 12:08:07 pm by AlexTP »

jcmontherock

  • Full Member
  • ***
  • Posts: 185
Re: Convert surrogate-pair chars to Unicode number?
« Reply #1 on: March 18, 2023, 12:00:34 pm »
In Facts it seems that there is 2 types of utf8: UTF8/UTF8MB3 and UTF8MB4, with emojis, stored in max. 4 bytes. Actually, I believe that only MySQL specify those 2 possibilities. I did not see these 2 separate encoding in Lazarus or UTF8 is UTF8MB4 (?).

AlexTP

  • Hero Member
  • *****
  • Posts: 2118
    • UVviewsoft
Re: Convert surrogate-pair chars to Unicode number?
« Reply #2 on: March 18, 2023, 12:07:52 pm »
Solved: UTF8CharacterToUnicode for ch+ch2 works indeed. I mistested it first.


 

TinyPortal © 2005-2018