Re: Encoding
Re: Encoding
- Subject: Re: Encoding
- From: Axel Luttgens <email@hidden>
- Date: Fri, 20 Feb 2015 18:19:22 +0100
Le 19 févr. 2015 à 23:28, Iurista GmbH a écrit :
> Hello
>
> I'm running a MacMini (mid 11) with system 10.6.8
>
> For testing purposes, I have:
> 1. A plistfile called AAA.plist
> 2. Therein a single key called Testkey (class string)
> 3. A script for writing to AAA
> 4. A script for reading the value of Testkey
>
> My two scripts work both fine, with the exception, that the script for reading back does not recognise special characters like the German Umlauts.
>
> TESTING WRITE:
> do shell script ("defaults write AAA Testkey " & "ÖÜÄöüä") <--That are the German Umlauts, upper and lower case
> Result: The correct representation of the characters
>
>
> TESTING READ
> set version to 1
> if version = 1 then set x to (do shell script ("defaults read AAA Testkey"))
> if version = 2 then set x to (do shell script ("defaults read AAA " & quoted form of "Testkey"))
> if version = 3 then set x to (do shell script ("defaults read AAA " & "Testkey"))
> if version = 4 then set x to quoted form of (do shell script ("defaults read AAA Testkey"))
>
> return x
> Result of all versions: "\\326\\334\\304\\366\\374\\344"
> [...]
Hello Rudolf,
Same behavior here, with Mavericks.
The problem seems to reside on the "defaults read" command's side:
$ defaults read AAA
{
Testkey = "\\U00d6\\U00dc\\U00c4\\U00f6\\U00fc\\U00e4";
}
$ defaults read AAA Testkey
\326\334\304\366\374\344
I never noticed it, but it's interesting, to say the least... ;-)
Anyway, System Events might provide a workaround:
tell application "System Events" to get value of property list item "Testkey" of property list file "~/Library/Preferences/AAA.plist"
HTH,
Axel
_______________________________________________
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
References: | |
| >Encoding (From: Iurista GmbH <email@hidden>) |