#437894 - 06/12/06 03:25 AM
Re: KML vs KMZ
  
[Re: simon_a]
|
Craftsman
Registered: 07/30/05
Posts: 148
Loc: Piracicaba, Sao Paulo, Brasil ...
|
Hi simon_a Quote:
I can't find a way of getting a VBA script to output data encoded as UTF-8, so I have to open the output in notepad.exe and re-save choosing UTF-8.
I think I could use the a function like this one to encode UTF-8 in a VBA macro.
Private Declare Function WideCharToMultiByte Lib "kernel32" (ByVal CodePage As Long, ByVal dwFlags As Long, ByVal lpWideCharStr As Long, ByVal cchWideChar As Long, ByVal lpMultiByteStr As Long, ByVal cchMultiByte As Long, ByVal lpDefaultChar As Long, ByVal lpUsedDefaultChar As Long) As Long
Public Function UTF8_Encode(ByVal instring As String) As String
Dim sBuffer As String Dim lLength As Long
If instring <> "" Then lLength = WideCharToMultiByte(CP_UTF8, 0, StrPtr(instring), -1, 0, 0, 0, 0) sBuffer = Space$(lLength) lLength = WideCharToMultiByte(CP_UTF8, 0, StrPtr(instring), -1, StrPtr(sBuffer), Len(sBuffer), 0, 0) sBuffer = StrConv(sBuffer, vbUnicode) UTF8_Encode = Left$(sBuffer, lLength - 1) Else UTF8_Encode = "" End If
End Function
|
|
Top
|
|
|
|
Moderator: BeadieJay, bebop, Cyclonic, Delta102, dulce, esterrett, Frank_McVey, Hill, jeffryv, Jumble, Kempster, LuciaM, marinerfan, Noisette, NormB, no_stranger, tekgergedan, TheLedge
|
|