The problem is in oemansi.c:
- Code: Select all Expand view
// oemansi.c
LPWSTR AnsiToWide( LPSTR cAnsi )
{
WORD wLen;
LPWSTR cString;
...
MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, cAnsi, -1, ( LPWSTR ) cString, wLen );
...
AnsiToWide() is called everywhere. It converts ansi string to unicode string using user code page for non Unicode programs.
And then that unicode string is used for drawing, creating windows, etc ...
BUT - we have a number of users who have En-US CP_ACP settings (for example required by corporate standard), but
use our software with CP852 or CP1250. We set that in REQUEST and cdp_Select() and etc... And that works with GTWVT.
Using MultiByteToWideChar( CP_ACP, ... ) when string is in fact cp852 (or cp1250 or anything different from CP_ACP) leads to
wrong Unicode converted code points for chars above #127, and the end result is garbled text on screen.
To fix this isue, I need Antonio to do conversion using Harbour API (respecting hb selected code page) instead of MultiByteToWideChar().
Regards
Dusan Majkic