• 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: unicode to text string
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: unicode to text string


  • Subject: Re: unicode to text string
  • From: Paul Skinner <email@hidden>
  • Date: Sun, 8 Dec 2002 23:45:03 -0500

On Sunday, December 8, 2002, at 12:26 PM, list account wrote:

A lot of apps now seem to return string as unicode. So you have first to coerce your string to plain text. There is no easy way in AppleScript to do this, but Steve Mills on SD-Talk (the Script Debugger list) offered this solution. <http://groups.yahoo.com/group/sd-talk/message/1130>

on u2a(s)
set num to number of characters of s
set res to ""
repeat with i from 1 to num
set res to res & (ASCII character (ASCII number
character i of s))
end repeat
return res
end u2a

Does any one have a better/ faster way? This is really slow for large strings.
Samuel C. DeVore

I bet!

set someText to "abc" as Unicode text-->unicode text string

set {text:someText} to (text of someText) as text-->styled text string *

someText-->plain text string

* Note: Due to the unusual list assignment method; this line returns a syled text string. The value of plainText is plain text despite this result. If you had wanted styled text from unicode you could set plainText to the result.
--
Paul Skinner
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.
References: 
 >unicode to text string (From: list account <email@hidden>)

  • Prev by Date: Any editor that does vertical cutting-pasting?
  • Next by Date: RE: Is it safe?
  • Previous by thread: unicode to text string
  • Next by thread: Re: unicode to text string
  • Index(es):
    • Date
    • Thread