[Gambas-bugtracker] Bug #2539: Incorrect wokr Conv from "UTF-8" to "WCHAR_T"

bugtracker at gambaswiki.org bugtracker at gambaswiki.org
Thu May 5 22:02:33 CEST 2022


http://gambaswiki.org/bugtracker/edit?object=BUG.2539&from=L21haW4-

Comment #7 by Benoît MINISINI:

I think I understand the problem: The Conv() function, based on the iconv libc API, does not know the character size of the target charset, and so the final string is only terminated by a single null byte, where as "wchar_t *" expects a wide-character string terminated by a wide null character (i.e. fours null bytes).

Can you try to add a Chr$(0) at the end of the string before doing the conversion? It should fix the bug.

Conv("Port\0", "UTF-8", "WCHAR_T")
Conv("2\0", "UTF-8", "WCHAR_T")
... and so on.




More information about the Bugtracker mailing list