# Conv$

ConvertedString = Conv$ ( String AS String , SourceCharset AS String , DestinationCharset 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 interpreter internally uses the `UTF-8` charset.

The charset used by the system is returned by System.Charset. It is `ISO-8859-1` on a Mandrake 9.2, but `UTF-8` on a RedHat! In the future, all Linux systems will probably be `UTF-8` based.

The charset used by the graphical user interface is returned by Desktop.Charset. It is `UTF-8` with the Qt component.

The conversion relies on the iconv() GNU library 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

See also

Desktop.Charset, System.Charset, How to translate Gambas

Previous: CONTINUE Next: COPY