Umlaut conversion script now failing

A while back, I had some help with translating German umlaut letters (ü, ö, ä) so that they were seen correctly by web browsers when automating internet searches.

I’ve just used a site this morning I haven’t accessed in a while and found that the conversion “function” that I have isn’t working any more.

Here is the code:

set searchEncoded to do shell script "/bin/echo -n " & quoted form of search & " | iconv -f utf8 -t iso-8859-1 | php -r '$handle = fopen (\"php://stdin\",\"r\"); $line = fgets($handle);echo urlencode($line);'"

To give you a short example, I did this:

set search to "Ãœber"

set searchEncoded to do shell script "/bin/echo -n " & quoted form of search & " | iconv -f utf8 -t iso-8859-1 | php -r '$handle = fopen (\"php://stdin\",\"r\"); $line = fgets($handle);echo urlencode($line);'"

The result that then appeared in the Result pane was:

“%DCber”

I guess something must have changed when I upgraded to Lion as this always used to work before.

Can anyone advise how to fix this?

Regards,

Bowjest

Not behind a Lion machine at the moment but can it be possible that the website is UTF-8 in meantime. So Ãœber should be %C3%9Cber (remove the iconv part) and not %DCber? Just a suggestion…

Thanks, DJ Bazzie Wazzie.

I’ll need to test this a bit more, but that seems to have fixed things.

Regards,

Bowjest