lotusscript开发者论坛

# 在LotusScript中处理UTF-8编码的内容

Function Utf8Decode(s As String) As String
Dim i As Integer
Dim tmp As String
Dim c As String
tmp = ""
For i = 1 To Len(s)
c = Mid$(s, i, 1) If c = "+" Then c = " " Elseif c = "%" Then c = Mid$(s, i + 1, 2)
If (Val("&H" & c) >= 0) And (Val("&H" & c) <= Val("&H7F")) Then
c = Uchr$("&H" & c) i = i + 2 Elseif (Val("&H" & c) >= Val("&HC0")) And (Val("&H" & c) <= Val("&HDF")) Then c = Right(Bin$(Val("&H" & Mid$(s, i + 1, 2))),5) c = c & Right(Bin$(Val("&H" & Mid$(s, i + 4, 2))),6) c = Uchr$("&B" & c)
i = i + 5
Elseif (Val("&H" & c) >= Val("&HE0")) And (Val("&H" & c) <= Val("&HEF")) Then
c = Right(Bin$(Val("&H" & Mid$(s, i + 1, 2))),4)
c = c & Right(Bin$(Val("&H" & Mid$(s, i + 4, 2))),6)
c = c & Right(Bin$(Val("&H" & Mid$(s, i + 7, 2))),6)
c = Uchr$("&B" & c) i = i + 8 Else c = Mid$(s, i, 3)
i = i + 2
End If
End If
tmp = tmp + c
Next i
Utf8Decode = tmp
End Function

#### 最近一周总结

2018-02-26 22:29:03

#### 程序员百度云干货 不谢~~~~~~

2017-02-06 16:51:47

#### 解一元二次不等式

2014-10-05 13:24:02

#### 菜刀 ASP链接SHELL 抓包结果及分析

2016-05-08 05:55:17

#### 挑战30天 C/C++ 入门极限系列教

2007-05-06 17:48:00

#### opencv2对直方图的求解以及描述

2014-12-17 17:34:05

#### PHP WebShell源码下载(1)

2016-08-27 15:17:13

#### Codeforces Round #329 (Div. 2) 593D. Happy Tree Party(树链剖分)

2016-01-27 13:58:09

#### URL转义

2014-12-09 00:05:29

#### 使用LotusScript获取多值域的值

2009-09-08 15:17:00