fb:porticula NoPaste
UTF8/ASCII Konvertierung (FB-Intern)
Uploader: | Eternal_Pain |
Datum/Zeit: | 07.08.2007 20:20:16 |
Declare Function myCharToUTF Cdecl Alias "fb_CharToUTF" ( Byval encod As Integer, _
Byval src As Zstring Ptr, _
Byval chars As Integer, _
Byval dst As Any Ptr, _
Byval bytes As Integer Ptr ) As Any Ptr
Declare Function myUTFToChar Cdecl Alias "fb_UTFToChar" ( Byval encod As Integer, _
Byval src As Any Ptr, _
Byval dst As Zstring Ptr, _
Byval chars As Integer Ptr ) As Zstring Ptr
Declare Function ASCII2UTF (Byval ConvertString As String) As String
Declare Function UTF2ASCII (Byval ConvertString As String) As String
/'
ASCII2UTF
Syntax : ASCII2UTF (MeinText[$])
Typ : Funktion
Kategorie : Stringmanipulation
Wandelt einen "String" mit ASCII Inhalt zu einen "String" mit UTF8 Inhalt um.
'/
Function ASCII2UTF (Byval ConvertString As String) As String
Dim As Zstring Ptr pZ
Dim As Zstring Ptr pR
Dim As Integer lS
Dim As Integer Ptr pI
lS = Len(ConvertString)
pI = Callocate(1)
pR = Callocate(4 * lS)
pZ = Strptr(ConvertString)
myCharToUTF( 1, pZ, lS, pR, pI)
pR = Reallocate(pR, *pI)
Function = *pR
Deallocate pI
Deallocate pR
End Function
/'
ASCII2UTF
Syntax : UTF2ASCII (MeinText[$])
Typ : Funktion
Kategorie : Stringmanipulation
Wandelt einen "String" mit UTF8 Inhalt zu einen "String" mit ASCII Inhalt um.
'/
Function UTF2ASCII (Byval ConvertString As String) As String
Dim As Zstring Ptr pZ
Dim As Zstring Ptr pR
Dim As Integer lS
Dim As Integer Ptr pI
lS = Len(ConvertString)
pI = @lS'Callocate(1)
pR = Callocate(4 * lS)
pZ = Strptr(ConvertString)
myUTFToChar( 1, pZ, pR, pI)
pR = Reallocate(pR, *pI)
Function = *pR
Deallocate pI
Deallocate pR
End Function