Detect the unicode character

YasserKhalil
PlatinumLounger
Posts: 4913
Joined: 31 Aug 2016, 09:02

Detect the unicode character

Post by YasserKhalil »

Hello everyone

I have a string and within the string, I have this character "ä" .. How can I detect the unicode character of this letter?
I know this issue may be trivial but I forgot about it every time so I am intending to post a series of questions so as to learn correctly this issue

User avatar
HansV
Administrator
Posts: 78481
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Detect the unicode character

Post by HansV »

The AscW function returns the decimal Unicode value of a character.

AscW("ä") returns 228 (in this example, "ä" is actually part of the ANSI character set). If you want the hexadecimal value, you can use Hex(AscW(...)).
Best wishes,
Hans

YasserKhalil
PlatinumLounger
Posts: 4913
Joined: 31 Aug 2016, 09:02

Re: Detect the unicode character

Post by YasserKhalil »

Thank you very much. That's very informative
Suppose I have the hexadecimal value which is in this case E4. How can I reverse to get the character?

User avatar
HansV
Administrator
Posts: 78481
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Detect the unicode character

Post by HansV »

Code: Select all

    Dim strHex As String
    Dim strChar As String
    Dim lngDec as Long
    strHex = "E4"
    lngDec = CLng("&H" & strHex)
    strChar = ChrW(lngDec)
Best wishes,
Hans

YasserKhalil
PlatinumLounger
Posts: 4913
Joined: 31 Aug 2016, 09:02

Re: Detect the unicode character

Post by YasserKhalil »

Thank you very much my tutor. I will try to learn more about the issue and if I have any questions, I will post it here.
Best Regards