Data update
This commit is contained in:
parent
5150844a7d
commit
4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions
|
|
@ -6,16 +6,44 @@ func$ tohex h .
|
|||
.
|
||||
return r$
|
||||
.
|
||||
func$ urlenc s$ .
|
||||
func[] utf8enc s$ .
|
||||
for c$ in strchars s$
|
||||
c = strcode c$
|
||||
if c >= 48 and c <= 57 or c >= 65 and c <= 90 or c >= 97 and c <= 122
|
||||
#
|
||||
if c < 0x80
|
||||
cnt = 0
|
||||
pre = 0
|
||||
elif c < 0x800
|
||||
cnt = 1
|
||||
pre = 0xc0
|
||||
elif c < 0x10000
|
||||
cnt = 2
|
||||
pre = 0xe0
|
||||
elif c < 0x200000
|
||||
cnt = 3
|
||||
pre = 0xf0
|
||||
else
|
||||
c$ = "%" & tohex c
|
||||
return [ ]
|
||||
.
|
||||
for i to cnt + 1 : r[] &= 0
|
||||
for i = 0 to cnt - 1
|
||||
l = c mod 0x40 + 0x80
|
||||
c = c div 0x40
|
||||
r[$ - i] = l
|
||||
.
|
||||
r[$ - i] = c + pre
|
||||
.
|
||||
return r[]
|
||||
.
|
||||
func$ urlenc s$ .
|
||||
b[] = utf8enc s$
|
||||
if b[] = [ ] : return ""
|
||||
for b in b[]
|
||||
if b >= 48 and b <= 57 or b >= 65 and b <= 90 or b >= 97 and b <= 122
|
||||
r$ &= strchar b
|
||||
else
|
||||
r$ &= "%" & tohex b
|
||||
.
|
||||
r$ &= c$
|
||||
.
|
||||
return r$
|
||||
.
|
||||
print urlenc "http://foo bar/"
|
||||
print urlenc "https://bn.wikipedia.org/wiki/রোসেটা_কোড"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue