#1 2025-01-19 15:37:22

zen010101
Member
Registered: 2024-06-15
Posts: 80

issue about PosIU()

see the code:

var
rawutf8str: RawUtf8 = '333你abc好33a';
...
writeln(PosI('ABC好',rawutf8str)); // result is 7
writeln(PosIU('ABC好',rawutf8str)); // result is 0, should be 7
synunistr := Utf8ToSynUnicode(rawutf8str);
writeln(Pos('abc好', synunistr)); // result is 5

PosIU() seems failed to find the substr.

Offline

#2 2025-01-19 15:50:16

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,793
Website

Re: issue about PosIU()

This is expected: PosIU() is not the same as PosI().
It is calling GetNextUtf8Upper() which only deals with WinAnsi (code page 1252) characters to deal with the accents appearing in this code page (e.g. é è ê ë e = E).

I just refined the documentation to make it more explicit and avoid such confusion.
https://github.com/synopse/mORMot2/commit/befb5906f

Offline

Board footer

Powered by FluxBB