I must want a native way, since I are really close above.
BTW I do not use MaxGUI and need doing that before sending to some dlls files (A plugin system for Jukebox software).
Hence I want some small native code. Is a module and example I should look to?
Here is the usable code and I put that one in the Code archives:
I know it can been faster, but it (should) work.
Please note:
Bin2Int is needed which can see in the UTF8 2 Unicode example (the other way).
EDIT:
hey, I should have looked in Code achives first, since Junkprogger allready have created such a function, that appeared recently.
BTW I do not use MaxGUI and need doing that before sending to some dlls files (A plugin system for Jukebox software).
Hence I want some small native code. Is a module and example I should look to?
Here is the usable code and I put that one in the Code archives:
Function UTF8$(Unicode$) Local RESULT$="" For Local i=1 To Len(Unicode$) Local Char$=Mid$(Unicode$,i,1) If Asc(Char$)<128 result$=result$+char$ ElseIf Asc(Char$)>127 And Asc(Char$)<2048 Local Bytes$=Right$(Bin$(Asc(Char$)),11) Local Byte1$="110"+Left$(Bytes$,5) Result$=Result$+Chr(Bin2Int(Byte1$)) Local Byte2$="10"+Right$(Bytes$, 6) Result$=Result$+Chr(Bin2Int(Byte2$)) Else Local Bytes$=Right$(Bin$(Asc(Char$)),16) Local Byte1$="1110"+Left$(Bytes$,4) Result$=Result$+Chr(Bin2Int(Byte1$)) Local Byte2$="10"+Mid$(Bytes$, 5, 6) Result$=Result$+Chr(Bin2Int(Byte2$)) Local Byte3$="10"+Right$(Bytes$, 6) Result$=Result$+Chr(Bin2Int(Byte3$)) EndIf Next Return Result$ EndFunction
I know it can been faster, but it (should) work.
Please note:
Bin2Int is needed which can see in the UTF8 2 Unicode example (the other way).
EDIT:
hey, I should have looked in Code achives first, since Junkprogger allready have created such a function, that appeared recently.