Visual Basic, .NET, ASP, VBScript
 

   
 

: :

, , ?
 
     

-

: 1 |

 

  : ISO to ANSI : 04.10.05 15:51  

:  Ejara | ICQ: 151006307 
ISO ANSI
.

  : 5  

: 1
:
 Pashenko



ICQ: 176176951 

: 14
: 655
  | | #1 : 04.10.05 16:09
Public Declare Function OemToChar Lib "user32" Alias "OemToCharA" (ByVal lpszSrc As String, ByVal lpszDst As String) As Long
Public Declare Function OemToCharBuff Lib "user32" Alias "OemToCharBuffA" (ByVal lpszSrc As String, ByVal lpszDst As String, ByVal cchDstLength As Long) As Long
Public Declare Function CharToOem Lib "user32" Alias "CharToOemA" (ByVal lpszSrc As String, ByVal lpszDst As String) As Long
Public Declare Function CharToOemBuff Lib "user32" Alias "CharToOemBuffA" (ByVal lpszSrc As String, ByVal lpszDst As String, ByVal cchDstLength As Long) As Long

: 2
:
 bom



: 0
: 6
  | | #2 : 04.10.05 17:08

WideCharToMultiByte
MultiByteToWideChar

: 3
:
 AndreyMp



ICQ: 237822510 

: 28
: 1182
  | | #3 : 04.10.05 17:26


Option Explicit

Enum Code
    Win = 1
    ;Dos = 2
    Koi = 3
    Iso = 5
End Enum
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

: 4
:
 AndreyMp



ICQ: 237822510 

: 28
: 1182
  | | #4 : 04.10.05 17:27
.

Option Explicit

Enum idCodePage
    Win = 1251
    ;Dos = 866
    Koi = 20866
    Iso = 28595
End Enum

Declare Function MultiByteToWideChar Lib "kernel32" (ByVal CodePage As Long, ByVal dwFlags As Long, _
        ByVal lpMultiByteStr As String, ByVal cchMultiByte As Long, ByVal lpWideCharStr As Long, _
        ByVal cchWideChar As Long) As Long
Declare Function WideCharToMultiByte Lib "kernel32" (ByVal CodePage As Long, ByVal dwFlags As Long, _
        ByVal lpWideCharStr As Long, ByVal cchWideChar As Long, ByVal lpMultiByteStr As String, _
        ByVal cchMultiByte As Long, ByVal lpDefaultChar As String, ByVal lpUsedDefaultChar As Long) As Long

Public Function ConvertCodePage(SourseString As String, inPage As idCodePage, outPage As idCodePage) As String
  Dim LenSourseString As Long
  Dim strFirst As String
  Dim strSecond As String
  Dim RetStrLong As Long
  LenSourseString = Len(SourseString)
  strFirst = String(LenSourseString * 2, Chr(0))
  strSecond = String(LenSourseString * 2, Chr(0))
  RetStrLong = MultiByteToWideChar(inPage, &H1, SourseString, LenSourseString, StrPtr(strFirst), LenSourseString)
  RetStrLong = WideCharToMultiByte(outPage, 0, StrPtr(strFirst), RetStrLong, strSecond, LenSourseString * 2, ByVal 0, 0)
  ConvertCodePage = Left(strSecond, RetStrLong)
End Function

: 5
:
 



: 13
: 30
  | | #5 : 31.05.06 06:00
. ISO - .

: 1 |



Copyright 2002-2011 VBNet.RU |