Navigation:  Reference > Functions By Category > Strings >

UTF8 / ANSI / OEM conversion

Previous pageReturn to chapter overviewNext page

Have a look at wikipedia ( -> http://www.wikipedia.org -> UTF8) for a explanation of UTF8.

 

With this functions you can convert a String from one format to another:

 

Syntax:

cAnsiToUtf8( cAnsi ) -> cUtf8

cUtf8ToAnsi(cUtf8) -> cAnsi

cOemToUtf8(cOem) -> cutf8

cUtf8ToOem(cUtf8) -> cOem

 

Parameters:

The parameter has to be a string in the right codepage.

 

Here a little test:

 

#include "ot4xb.ch"

#include "dll.ch"

// ---------------------------------------------------------------------------

function Main()

local cAnsi := Chrr(0,256)

local n

for n := 1 to 256

   cAnsi[n] := Chr(n-1)

next

lMemoWrite("testAnsi.txt" ,cUtf8ToAnsi(cAnsiToUtf8(cAnsi)))

lMemoWrite("testOem.txt" ,cUtf8ToOem(cOemToUtf8(cAnsi)))

 

return NIL

// ---------------------------------------------------------------------------