Re: Problem with text items and german umlauts
Re: Problem with text items and german umlauts
- Subject: Re: Problem with text items and german umlauts
- From: Christopher Nebel <email@hidden>
- Date: Mon, 3 Nov 2003 15:53:24 -0800
On Nov 3, 2003, at 11:28 AM, Daniel Blanken wrote:
A very simple problem, but I just can't find the solution to it...
I've got a script that gets a file's name and is supposed to replace
the
german umlauts with their 7-Bit ASCII counterparts ("D" is replaced
with
"Ae", for example).
My Problem: When splitting the original file name into single
characters the
script sorta "splits" the umlauts themselves. If the file name itself
is a
single d for example, the command "every character of name of (info
for..."
returns {"a","("} instead of {"d"}. Any ideas on how to make it return
the
{"d"}?
When you get the file name, get it "as string". Normally (in Mac OS X,
anyway) file names are Unicode, and because the file system uses
decomposed characters, the umlaut shows up separately from the base
character. (This is arguably a bug in how "character" elements of
Unicode text work.)
Anyway, when you coerce to "string", you get the non-Unicode composed
versions, so your search string will work. However, realize that you
will also trash any characters that can't be represented in the primary
text encoding, so if someone gives you a file name that uses, say,
Korean, you'll mangle it.
Alternatively, you can work entirely in terms of Unicode text, but
you'll have to construct the right search text -- that is, with the "a"
and the umlaut as separate characters. There are various ways to do
this; all of them are icky in one way or another.
--Chris Nebel
AppleScript Engineering
_______________________________________________
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.