以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  这种ASCII码要怎么转  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=189635)

--  作者:zhenghangbo
--  发布时间:2023/12/13 9:55:00
--  这种ASCII码要怎么转
     这种\\x跟\\u的字符要怎么转成中文 ,\\x应该是 ASCII码  ,\\u应该是Unicode     <CD>layoutSlip(\'\\x7Btital\\x3A\\x222023\\u5E74\\x2011\\u6708\\x3B\\u6D59\\u6C5F\\u7A7A\\u6E2F\\u6570\\u5B57\\u79D1\\u6280\\u6709\\u9650\\u516C\\u53F8\\x3B\\u6570\\u79D1\\u516C\\u53F8\\u676D\\u5DDE\\u673A\\u573A\\u5458\\u5DE5\\u6708\\u85AA\\u524D\\u65B9\\u6848\\x3B\\x28\\u4EBA\\u6C11\\u5E01\\x29\\x22,length\\x3A\\x2210\\x22,\\x20detail\\x3A\\x7Bitem0\\x3A\\x20\\x7Bname\\x3A\\x22\\u4EBA\\u5458\\u7F16\\u7801\\x22,type\\x3A\\x220\\x22,value\\x3A\\x22A03783\\x22\\x7D,item1\\x3A\\x20\\x7Bname\\x3A\\x22\\u59D3\\u540D\\x22

[此贴子已经被作者于2023/12/13 11:55:24编辑过]

--  作者:有点蓝
--  发布时间:2023/12/13 10:53:00
--  
Dim s1 As String = "\\x7Btital\\x3A\\x222023\\u5E74\\x2011\\u6708\\x3B\\u6D59\\u6C5F\\u7A7A\\......"
Dim bu As New StringBuilder
Dim ss() As String = s1.Split("\\")
For i As Integer = 1 To ss.Length - 1
    Dim s As String = ss(i)
    If s.StartsWith("x") Then
        Dim s2 As String = s.Substring(0, 3)
        Dim s3 As String = s.Substring(3)
        bu.Append(Encoding.ASCII.GetString({HexToDec(s2.Trim("x"))}))
        bu.Append(s3)
    ElseIf s.StartsWith("u") Then
        bu.Append(Regex.Unescape("\\" & s))
    Else
        bu.Append(s)
    End If 
Next
Output.Show(bu.ToString)

--  作者:zhenghangbo
--  发布时间:2023/12/13 11:50:00
--  
正确,厉害