• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Producing Unicode-only characters
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Producing Unicode-only characters


  • Subject: Re: Producing Unicode-only characters
  • From: kai <email@hidden>
  • Date: Wed, 26 Oct 2005 09:42:34 +0100


On 26 Oct 2005, at 03:43, Paul Berkowitz wrote:

On 10/25/05 7:22 PM, "Dave Lyons" <email@hidden> wrote:

Neat...but for anyone wanting to use that for arbitrary characters,
note that as written it only works if each of the 4 hex digits in the
character code is from 0 to 9.  Any digit A through F wreaks havoc.
(For example, 12367 turns into ?data utxt30415? rather than ?data
utxt304F?.)

on unicodeCharacter(n)
set ls to {n div 4096, n mod 4096 div 256, n mod 256 div 16, n mod 16}
repeat with i from 1 to 4
set x to item i of ls
if x > 9 then set item i of ls to item (x - 9) of {"A", "B", "C",
"D", "E", "F"}
end repeat
run script "?data utxt" & ls & "?"
end unicodeCharacter


unicodeCharacter(12367)
--> く

That does the trick.

I suppose you could also reverse the temporary file method:

-----------------------

on unicodeCharacters(l)
set fref to open for access file ((path to temporary items as Unicode text) & "Utxt chr.txt") with write permission
try
set eof fref to 0
repeat with i in l as list
write i to fref
end repeat
set t to read fref from 1 as Unicode text
end try
close access fref
t
end unicodeCharacters


unicodeCharacters({12360, 12361, 12362, 12363, 12364, 12365, 12366, 12367})

-----------------------

---
kai


_______________________________________________ Do not post admin requests to the list. They will be ignored. Applescript-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Re: Producing Unicode-only characters (From: Paul Berkowitz <email@hidden>)

  • Prev by Date: Re: curl...file listings...
  • Next by Date: Re: Producing Unicode-only characters [was: Finding \t, \r, \n reliably]
  • Previous by thread: Re: Producing Unicode-only characters
  • Next by thread: Re: Producing Unicode-only characters
  • Index(es):
    • Date
    • Thread