: 1 | 2 |
:
: 10.11.04 08:11
: gvozd | Web-:
. UTF-8.
:
Option Explicit
Public Enum Code
Win = 1
Dos = 2
Koi = 3
Iso = 5
End Enum
Public Function Recode(Char As String, Src As Code, Dest As Code) As String
Const wDos As String = ""
Const wIso As String = "ע"
Const wKoi As String = ""
Const wWin As String = ""
Const NotRecodedChar As String = "?"
If Src = Dest Then
Recode = Char
Exit Function
End If
Dim t As String, i As Long, tt As String, a As Long, ss As String, ch As String
If Src = Win Then
t = Char
Else
Select Case Src
Case Koi: ss = wKoi
Case Dos: ss = wDos
Case Iso: ss = wIso
End Select
For i = 1 To Len(Char)
ch = Mid(Char, i, 1)
If Asc(ch) < 128 Then
t = t & ch
Else
a = InStr(1, ss, ch, vbBinaryCompare)
If a = 0 Then
t = t & NotRecodedChar
Else
t = t & Mid$(wWin, a, 1)
End If
End If
Next i
End If
If Dest = Win Then
Recode = t
Else
Select Case Dest
Case Koi: ss = wKoi
Case Dos: ss = wDos
Case Iso: ss = wIso
End Select
For i = 1 To Len(Char)
ch = Mid(t, i, 1)
If Asc(ch) < 128 Then
tt = tt & ch
Else
a = InStr(1, wWin, ch, vbBinaryCompare)
If a = 0 Then
tt = tt & NotRecodedChar
Else
tt = tt & Mid$(ss, a, 1)
End If
End If
Next i
Recode = tt
End If
End Function
.
: 29
: 1
:
LamerOnLine
ICQ: 334781088
: 108
: 2822
| | #1
: 10.11.04 08:57
- ? - API WideCharToMultiByte ?
: 2
:
gvozd
Offline Client
: 164
: 1317
Web-:
| | #2
: 10.11.04 09:13
. .
. -
. .
, .
: 3
:
Offline Client
ICQ: 204034
: 106
: 1919
| | #3
: 10.11.04 14:23
/ sne . . , - .
: 4
:
gvozd
Offline Client
: 164
: 1317
Web-:
| | #4
: 10.11.04 16:51
- . ,
. . - ?
: 5
:
Comanche
: 87
: 459
| | #5
: 11.11.04 22:43
"" , , "WIN --> UTF-8". , , .
, , "" .
: 6
:
LamerOnLine
ICQ: 334781088
: 108
: 2822
| | #6
: 12.11.04 10:00
, - ? .
: 7
:
Comanche
: 87
: 459
| | #7
: 12.11.04 12:02
UTF-8(-7), WideCharToMultiByte , . ISO KOI - - . gvozd "-" - , . - - UTF- ( WideCharToMultiByte). ?!
: 8
:
LamerOnLine
ICQ: 334781088
: 108
: 2822
| | #8
: 12.11.04 12:06
ISO KOI ? ?
: 9
:
ZagZag
ICQ: 295002202
: 87
: 1684
| | #9
: 12.11.04 12:20
Barsic'a (-)
http://vbnet.ru/forum/show.aspx?id=57714
Attribute VB_Name = "basConvertCharset"
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
 OS = 866
Windows = 1251
ISO = 28595
KOI8R = 20866
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
ISO KOI (. , ), . . -
: 10
:
gvozd
Offline Client
: 164
: 1317
Web-:
| | #10
: 12.11.04 12:21
? .
sne . ,
.
: 11
:
LamerOnLine
ICQ: 334781088
: 108
: 2822
| | #11
: 12.11.04 12:26
, .
65000 - UTF-7
65001 - UTF-8
: 12
:
Comanche
: 87
: 459
| | #12
: 12.11.04 12:29
, )
: 13
:
LamerOnLine
ICQ: 334781088
: 108
: 2822
| | #13
: 12.11.04 12:37
? .
WideCharToMultiByte, .
: 14
:
ZagZag
ICQ: 295002202
: 87
: 1684
| | #14
: 12.11.04 12:42
( )
, , . .
Const ANSI_CHARSET As Long = 0
Const DEFAULT_CHARSET As Long = 1
Const SYMBOL_CHARSET As Long = 2
Const MAC_CHARSET As Long = 77
Const SHIFTJIS_CHARSET As Long = 128
Const HANGEUL_CHARSET As Long = 129
Const JOHAB_CHARSET As Long = 130
Const GB2312_CHARSET As Long = 134
Const CHINESEBIG5_CHARSET As Long = 136
Const GREEK_CHARSET As Long = 161
Const TURKISH_CHARSET As Long = 162
Const VIETNAMESE_CHARSET As Long = 163
Const HEBREW_CHARSET As Long = 177
Const ARABIC_CHARSET As Long = 178
Const BALTIC_CHARSET As Long = 186
Const RUSSIAN_CHARSET As Long = 204
Const THAI_CHARSET As Long = 222
Const EASTEUROPE_CHARSET As Long = 238
Const OEM_CHARSET As Long = 255
Const SETCHARSET As Long = 772
: 15
:
LamerOnLine
ICQ: 334781088
: 108
: 2822
| | #15
: 12.11.04 12:57
CharSet CodePage. ...