Re: Coercing alias with foreign characters to Unicode text
Re: Coercing alias with foreign characters to Unicode text
- Subject: Re: Coercing alias with foreign characters to Unicode text
- From: Paul Berkowitz <email@hidden>
- Date: Sun, 09 Oct 2005 01:45:37 -0700
- Thread-topic: Coercing alias with foreign characters to Unicode text
On 10/8/05 8:01 PM, "Martin Fuhrer" <email@hidden> wrote:
> I'm trying to get the path of a file as follows:
>
> set myAlias to choose file
> set myPath to (myAlias as Unicode text)
>
> This seems to work for the most part, but chokes on file names with
> certain foreign characters. For example, files containing the
> letters ěščřž (use the Czech keyboard layout, and type keys 2 to
> 6) produce an Applescript error on line 2:
>
> Can't make alias "Users:mfuhrer:Desktop:eˇsˇcˇrˇzˇ.jpg" into type
> Unicode text.
>
> File names including other foreign characters such as Thai work
> fine. Does this mean that Unicode text support is not fully working
> in Applescript, or am I doing something wrong? Thanks for any tips.
It seems to be a bug to do with pre-composed vs. de-composed diacritics.
Most of those were fixed a few versions back - at least for Western and
Northern European characters - but evidently remain for some East European
characters.
You can sort of work around it like this:
set myAlias to choose file
tell application "Finder"
set myName to name of myAlias
set folderPath to (container of myAlias) as Unicode text
end tell
set myPath to folderPath & myName
--> "PB G5 HD Tiger:Users:berkowit:Desktop:eˇsˇcˇrˇzˇ.txt"
except you still get this improper version where the accents are after, not
above, their characters. This is due to the AppleScript decompiler not being
able to display the real characters, but, if you add another line:
display dialog result
you actually see
PB G5 HD Tiger:Users:berkowit:Desktop:ěščřž.txt
displayed (in Tiger, at least), so AppleScript actually knows what the real
text is.
--
Paul Berkowitz
_______________________________________________
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