I get ‘Gesch%E4ftsf%FChrer‘ instead ‘Geschäftsführer‘

Hi,

I’m a absolute beginner. In FileMaker Pro I wrote this calculated AppleScript:

“tell application "Safari"¶ activate¶ set url of document 1 to "”
&
$URL
&
“"¶end tell”

The script works fine, as long appear in the FileMaker variable $URL no German umlauts (see title). Then the URL will be changed and will therefore no longer be recognized by the browser.

Who can help?

TIA
Since1984

Hello.

Maybe this works with a calculated AppleScript, the php snippet, that performs the decoding, that is “normalizing” your umlauted characters, is curtsey of DJ Bazzie Wazzie.

Hopefully I have gotten the quotes right, and that you can define an applescript variable in a calculated Applescript. (Obviusly, I haven’t tried this.)

Returns and everything else may also be wrong in this, so you’ll have to check for the line endings as well, (against your original script.)

" set newUrl to ( do shell script \"/bin/echo -n \" & quoted form of $URL & \" | php -r ' echo rawurldecode(fgets(STDIN)); '\") tell application \"Safari\"¶ activate¶ set url of document 1 to newURL¶end tell"

Hello McUsrII,

thank you very much. It would be easier for me if you show me your code snippet in “only AppleScript”.

I think, I will test it in AppleScript first and make then the changes for FM.

TIA
Since1984

Hello.

The code would look like this:

I can’t make it decode the characters correctly, so I doubt you will be able to it either. I think either it is a big/little endian thing, or that Filemaker Pro, has it’s own decoding scheme.

I don’t know if it does the trick for you, but you could use a webvier to show your url in, if everything else fails. Like making a new form in Filemaker with a webviewer in it.

Hopefully it works for you though. :confused:

set theURL to "Gesch%E4ftsf%FChrer"
set decodedUrl to rawURLDecode(theURL)
display dialog decodedUrl
#tell application "Safari"
#	activate
#	set url of document 1 to decodedUrl
# end tell

on rawURLDecode(aMaybeEncodedUrl)
	return do shell script "/bin/echo -n " & quoted form of aMaybeEncodedUrl & " | php -r ' echo rawurldecode(fgets(STDIN)); '"
end rawURLDecode

Edit

Even though the code doesn’t decode the url correctly from applescript, I do have high hopes that it will so from within a calculated applescript, because hopefully Filemaker then either adjusts its encoding, or the applescript environment adjusts its interpretation somehow, along the way, so that what turns up in your browser, isn’t what is fed to the applescript.