Re: Bad Characters from Unicode
Re: Bad Characters from Unicode
- Subject: Re: Bad Characters from Unicode
- From: has <email@hidden>
- Date: Tue, 2 Oct 2007 18:30:50 +0100
Luther Fuller wrote:
[snip - not been following this thread, but here's some general
observations]
1. If you don't already have some understanding of character sets,
encodings, the distinction between 'bytes' and 'characters', etc.
then I recommend brushing up your knowledge first as you won't get
far otherwise. Here's a good place to start:
http://www.joelonsoftware.com/articles/Unicode.html
2. AppleScript's Unicode support is 1. crap, and 2. partly broken. In
particular, its list-to-Unicode-text coercion is buggy and may
produce truncated text. If you must do text processing in
AppleScript, use TextCommands or a Unicode-aware scriptable text
editor (e.g. Text Wrangler, Smile) to do the actual work. e.g.
TextCommands has commands for splitting and joining text, changing
case and finding and replacing.
3. If you need to convert text between different encodings, use the
appropriate tools - e.g. the command-line textutil utility,
TextCommands' 'convert from unicode', 'convert to unicode' and
'stringify' commands, etc.
BTW, if you do a lot of text processing or regularly deal with non-
ASCII encodings, then unless you're a sadomasochist I'd recommend
finding yourself a better language than AppleScript. e.g. Python's
Unicode support is pretty good (TextCommands is just a thin wrapper
around some of Python's text handling capabilities, incidentally) and
even Perl or Ruby, while a bit rough on the Unicode side, would be an
improvement. (Python, Perl and Ruby also have extensive application
scripting support, btw.)
HTH
has
--
http://appscript.sourceforge.net
http://rb-appscript.rubyforge.org
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden