zoukankan      html  css  js  c++  java
  • UNICODE文字转换问题(终于解决了2007/2/8)

    我的页面是日文编码。
    现在遇到一个问题,文本框里姓名的地方可能有中文姓名,现在输入中文姓名,保存到数据库中后,姓名在表中是用unicode得编码存放的,在 显示 到页面上也没有问题,现在是还要打印到Excel中,结果就有问题了。
    打印出来的数据是Unicode码,而不是中文。
    如:“婷嫗“   在Excel中显示“婷嫗”

    解决方案:
    Function uni2gb(str)

        Dim tmp,tmpstr,i

        tmpstr 
    = ""

        For i 
    = 1 To Len(str)

            tmp
    =Mid(str,i,1)

            If tmp 
    = "&" And Mid(str,i + 1,1= "#" And Mid(str,i + 7,1= ";" And IsNumeric(Mid(str,i + 2,5)) = True Then 
                tmpstr 
    = tmpstr & ChrW(Mid(str,i + 2,5))
                i 
    = i + 7
            Else
                tmpstr 
    = tmpstr & tmp
            End If
        Next

        uni2gb
    =tmpstr

    End Function 
  • 相关阅读:
    【02】AJAX XMLHttpRequest对象
    【01】什么是AJAX
    NPM是什么
    nodejs npm常用命令
    angular(转)
    s6 传输层
    s6-9 TCP 定时器
    s6-8 TCP 拥塞控制
    s6-7 TCP 传输策略
    s6-6 TCP 连接释放
  • 原文地址:https://www.cnblogs.com/meil/p/636658.html
Copyright © 2011-2022 走看看