Closed blue8228 closed 1 year ago
On which OS ? On which compiler ?
The +1
is not expected because it is up to the caller to add the trailing #0.
The shl fAnsiCharShift
is not needed either, because we should use number of UTF-16 chars, not the bytes count.
On Windows, it just calls WideCharToMultiByte() which requires the UTF-16 chars count.
On Linux, it calls either Unicode2AnsiMoveProc() or ucnv_fromUChars() which also both require the UTF-16 chars count.
So I don't understand your modifications. Please use the synopse forum for discussion about this.
I guess the discussion continues at https://synopse.info/forum/viewtopic.php?id=6583
src\core\mormot.core.unicode.pas src\core\mormot.core.unicode.pas
Unicode_WideToAnsi(Source, Dest, SourceChars, SourceChars, fCodePage)); --->>> Unicode_WideToAnsi(Source, Dest, SourceChars, (SourceChars + 1) shl fAnsiCharShift, fCodePage));