Sync
This commit is contained in:
parent
6f050a029e
commit
776bba907c
3887 changed files with 59894 additions and 7280 deletions
|
|
@ -1,12 +1,32 @@
|
|||
set inString to "Hello World" as Unicode text
|
||||
set inString to "Hello é̦世界"
|
||||
set byteCount to 0
|
||||
set idList to id of inString
|
||||
|
||||
repeat with incr in idList
|
||||
set byteCount to byteCount + 2
|
||||
if incr as integer > 65535 then
|
||||
set byteCount to byteCount + 2
|
||||
end if
|
||||
repeat with c in inString
|
||||
set t to id of c
|
||||
if ((count of t) > 0) then
|
||||
repeat with i in t
|
||||
set byteCount to byteCount + doit(i)
|
||||
end repeat
|
||||
else
|
||||
set byteCount to byteCount + doit(t)
|
||||
end if
|
||||
end repeat
|
||||
|
||||
byteCount
|
||||
|
||||
on doit(cid)
|
||||
set n to (cid as integer)
|
||||
if n > 67108863 then -- 0x3FFFFFF
|
||||
return 6
|
||||
else if n > 2097151 then -- 0x1FFFFF
|
||||
return 5
|
||||
else if n > 65535 then -- 0xFFFF
|
||||
return 4
|
||||
else if n > 2047 then -- 0x07FF
|
||||
return 3
|
||||
else if n > 127 then -- 0x7F
|
||||
return 2
|
||||
else
|
||||
return 1
|
||||
end if
|
||||
end doit
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue