I would like to determine the UTF-8 encoding for characters in Excel VBA in order to know how many bytes UTF-8 uses to store individual characters.
Internally, Excel uses two byte character encoding. I believe it is UTF-16, but I have seen conflicting information on the web.
For example, the Tokyo in Japanese is two characters: 東京
The first character 東 has the following values:
VBA AscW(東): 20140
Converting the single character string to a two element byte array: array(0) is AC and array(1) is 4E.
東 in UTF-8 is hex:e6 9d b1
東 in UTF-8 is binary: 11100110 10011101 10110001 (I used Excel's HEX2BIN() function.
I have seen samples of converting Excel data to a UTF-8 text file, but I don't want to save to file in order to open it an read it into a byte array. I have not been able to find a function the give me UTF-8 information in VBA. I would like a function that returns either the UTF-8 character encoding in either hex or binary.
Thank,
SiebPaul
Bookmarks