Vote UpVote

Parsing UTF8 strings

The Programming Works – Windows API functions like CharNextExA do not support UTF8 encoding; you can test CharNextExA with UTF8 codepage (65001) and UTF8 strings and see it does not work. If you need to calculate for example the number of unicode codepoints in UTF8 string you should parse UTF8 string manually. Fortunately the task is very simple and boils down to the following function: function UTF8IsLeadChar(Ch: AnsiChar): Boolean; begin Result:= Ord(Ch) and $C0 <> $80; end; the function that returns number of unicode codepoints in UTF8 string looks as follows: function UTF8CharCount(const S: ...
Favorite? Off-Topic? Serg @ 2012-05-01 05:46


Visits: 712
Votes: 0
Favorites: 0
Off-Topic: 0

Visits by Source

User Actions

Users who voted for this posting

Contact us to advertise on DelphiFeeds.com

Community Links

Torry Firebird News


Please login or register to use this functionality.
(click on this box to dismiss)