GSerg писал(а):Название топика несколько контрастирует с содержимым
tyomitch писал(а):Т.е. единственный способ - заменить все символы старше &HC0 вопросиками.
Option Explicit
Public Declare Function WideCharToMultiByte Lib "kernel32" (ByVal CodePage As Long, ByVal dwFlags As Long, ByVal lpWideCharStr As String, ByVal cchWideChar As Long, ByVal lpMultiByteStr As String, ByVal cchMultiByte As Long, ByVal lpDefaultChar As String, ByVal lpUsedDefaultChar As Long) As Long
Public Declare Function MultiByteToWideChar Lib "kernel32" (ByVal CodePage As Long, ByVal dwFlags As Long, ByVal lpMultiByteStr As String, ByVal cchMultiByte As Long, ByVal lpWideCharStr As String, ByVal cchWideChar As Long) As Long
Public Const MB_PRECOMPOSED = &H1
Enum Charset
Default = 0
OEM_Russian = 866
OEM_Korean = 949
Windows_1251 = 1251
Windows_1252 = 1252
Korean_Johab = 1361
Mac_Korean = 10003
Mac_Cyrillic = 10007
Korean_Extend = 20833
KOI_8R = 20866
KOI_8U = 21866
ISO_2022_Korean = 50225
Korean_Extended = 50933
EUC_Korean = 51949
UTF_7 = 65000
UTF_8 = 65001
End Enum
Public Function ConvertCharset(ByVal strString As String, ByVal FromCharset As Charset, ByVal ToCharset As Charset) As String
Dim lngLength As Long
Dim strWideChar As String
Dim strReturn As String
Dim lngReturnLength As Long
lngLength = Len(strString)
strWideChar = String$(lngLength * 2, Chr(0))
strReturn = String$(lngLength * 2, Chr(0))
lngReturnLength = MultiByteToWideChar(FromCharset, MB_PRECOMPOSED, strString, lngLength, strWideChar, lngLength)
WideCharToMultiByte ToCharset, 0, strWideChar, lngReturnLength, strReturn, lngLength * 2, ByVal 0, 0
ConvertCharset = Left$(strReturn, lngReturnLength)
End Function
Сейчас этот форум просматривают: Majestic-12 [Bot] и гости: 58