Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Convert iso-8859 codepage/charset string to another
Message
 
To
03/10/2006 16:04:37
Emerson Reed
Folhamatic Tecnologia Em Sistemas
Americana - São Paulo, Brazil
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01159097
Message ID:
01159226
Views:
17
Hi, Emerson!
Below is a function, that, may be, will be usefull for You.
FUNCTION udf_CPConverter()
Lparameters nCurrentCodePage, nNewCodePage, cString )

Declare Integer IsValidCodePage in WIN32API ;
     integer nCodePage

Declare Integer MultiByteToWideChar in WIN32API ;
     integer CodePage,;
     integer Flags,;
     string MultyByteStr,;
     integer MultiByteStrLen,;
     string @ WideCharStr,;
     integer WideCharStrLen


Declare Integer WideCharToMultiByte in WIN32API ;
     integer CodePage,;
     integer Flags,;
     string MultyByteStr,;
     integer MultiByteStrLen,;
     string @ WideCharStr,;
     integer WideCharStrLen,;
     integer ,;
     integer 
     
     
If IsValidCodePage(nCurrentCodePage) = 0
     Error 1914
     Return ""
EndIf
     
If IsValidCodePage(nNewCodePage) = 0
     Error 1914
     Return ""
EndIf
     
Local WideCharBuf, MultiByteBuf
WideCharBuf=Replicate(Chr(0),Len(cString)*2)
MultiByteBuf=Replicate(Chr(0),Len(cString))

MultiByteToWideChar;
     (nCurrentCodePage;
     ,0;
     ,cString;
     ,Len(cString);
     ,@WideCharBuf;
     ,Len(WideCharBuf))


WideCharToMultiByte;
     (nNewCodePage;
     ,0;
     ,WideCharBuf;
     ,Len(WideCharBuf);
     ,@MultiByteBuf;
     ,Len(MultiByteBuf);
     ,0,0)
     
Return MultiByteBuf
Code Page Identifiers for ISO-8859 are:

28591 ISO 8859-1 Latin I
28592 ISO 8859-2 Central Europe
28593 ISO 8859-3 Latin 3
28594 ISO 8859-4 Baltic
28595 ISO 8859-5 Cyrillic
28596 ISO 8859-6 Arabic
28597 ISO 8859-7 Greek
28598 ISO 8859-8 Hebrew
28599 ISO 8859-9 Latin 5
28605 ISO 8859-15 Latin 9

This code I have received from my friend - Vadim Pirozkov.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform