Closed GoogleCodeExporter closed 9 years ago
[deleted comment]
Function jsEncod8(str)
Dim i, j, s, l, c, a, cv(127), js()
cv(8)="\b": cv(9)="\t": cv(10)="\n": cv(12)="\f": cv(13)="\r": cv(34)="\""":
cv(47)="\/": cv(92)="\\"
j = 0: s = 1: l=0
Redim js(len(str))
For i = 1 To Len(str)
c = Mid(str, i, 1)
a = AscW(c)
If a < 127 Then
If IsEmpty(cv(a)) Then
If a > 31 Then
l = l + 1
Else
js(j) = Mid(str, s, l) & "\u" & Right("000" & Hex(a),4)
l = 0: j = j + 1: s = i + 1
End If
Else
js(j) = Mid(str, s, l) & cv(a)
l = 0: j = j + 1: s = i + 1
End if
Else
js(j) = Mid(str, s, l) & "\u" & Right("000" & Hex(a),4)
l = 0: j = j + 1: s = i + 1
End If
Next
js(j) = Mid(str, s, l)
jsEncod8 = Join(js,"")
End Function
Original comment by gvanvrec...@gmail.com
on 28 Jul 2009 at 9:30
jsEncode(str) has a problem.
It doesn't work with mulitibyte language string as parameter (like
"尖첨密謐" )
so, I change source code
For i = 1 To Len(str)
c = Mid(str, i, 1)
a = AscW(c)
If a < 127 Then
For i = 1 To Len(str)
c = Mid(str, i, 1)
a = AscW(c)
If a > 31 And a < 127 Then
Original comment by darkma...@gmail.com
on 13 Aug 2009 at 2:11
Original comment by tugrulto...@gmail.com
on 8 Nov 2009 at 8:22
Original comment by tugrulto...@gmail.com
on 9 Nov 2009 at 11:04
Original issue reported on code.google.com by
gvanvrec...@gmail.com
on 28 Jul 2009 at 8:43