Re: Getting the ASCII code of a Unicode multibyte character

"'Neil Hodgson' via scintilla-interest" <[email protected]> Sun, 26 Jan 2025 09:54:17 +1100
Newsgroups gmane.comp.lib.scintilla.devel
Message-ID <[email protected]>
Jean Lalonde:

> I needed to get the ASCII code of a multibyte character.

   Strictly speaking, ASCII is a 7-bit encoding. The equivalent here is the Unicode code point value.

> The following code (AutoHotkey v1.1) shows the ASCII code of the 3 characters in the Scintilla editor. The second character is a multibyte character. The function GetAsciiCode() gets the code by looking ahead in the editor stream when the Asc() function returns an error.
> 
> Am I missing a built-in Scintilla command that would allow to do that without the GetAsciiCode() workaround?

   It would be better to ask for the number of bytes in the character by calling SCI_POSITIONAFTER then retrieving the bytes of that character and calculating the code point from the UTF-8 bytes.
https://scintilla.org/ScintillaDoc.html#SCI_POSITIONAFTER

   Neil

-- 
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion visit https://groups.google.com/d/msgid/scintilla-interest/E728B7D9-163B-4A61-97A7-3FCB11B40EE2%40me.com.