vb中有什么方法能获得中文字的gb2312码

解决方案 »

  1.   

    google "Unicode to gb2312" or "中文gb2312" or "GBK,GB2312" or "GBK to GB2312" or "BIG2GB" or "GBK2GB"...
      

  2.   

    给你两个函数参考, 它们的功能是一样的:Option ExplicitFunction GetGB2312_A(ByVal S As String)
        Dim A As Long
        A = Asc(S)
        If A < 0 Then A = A + 65536
        GetGB2312_A = (A \ 256 - 160) * 100 + A Mod 256 - 160
    End FunctionFunction GetGB2312_B(ByVal S As String)
        S = StrConv(S, vbFromUnicode)
        GetGB2312_B = (AscB(MidB(S, 1, 1)) - 160) * 100 + AscB(MidB(S, 2, 1)) - 160
    End FunctionPrivate Sub Form_Load()
        Debug.Print GetGB2312_A("啊")
        Debug.Print GetGB2312_B("啊")
        End
    End Sub