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

bugtracker at gambaswiki.org bugtracker at gambaswiki.org
Thu May 5 17:10:01 CEST 2022


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

Comment #1 by Benoît MINISINI:

Hi,

"wchar_t" is not a charset name, but a C library datatype name.

The corresponding charset name for "wchar_t" is "UCS-4BE" if your CPU is "big endian", or "UCS-4LE" if your CPU is "little endian".

So you have to write a function like that:

Sub ConvToWchart(S As String) As String

  Return Conv(S, "UTF-8", If(System.ByteOrder = gb.BigEndian, "UCS-4BE", "UCS-4LE"))

End Sub

You should better use the mailing-list for such questions that may interest other people, and keep the bugtracker for bugs and feature requests only.




More information about the Bugtracker mailing list