Converted string = Conv$ ( String AS String , Source charset AS String , Destination charset AS String )
Converts a string from one charset to another charset. A charset is represented by a string like "ASCII", "ISO-8859-1"
, or "UTF-8"
.
The GAMBAS interpreters only deals with ASCII strings. The charset used by the system is returned by System.Charset, and the charset used by the graphical user interface is returned by Desktop.Charset.
The conversion relies on the iconv() GNU system function.
Example :
DIM sStr AS String DIM iInd AS Integer sStr = Conv$("Gambas", "ASCII", "EBCDIC-US") FOR iInd = 1 TO Len(sStr) PRINT Hex$(Asc(Mid$(sStr, iInd, 1)), 2); " "; NEXT => C7 81 94 82 81 A2