Re: Strange char "?" in html source from Safari
Re: Strange char "?" in html source from Safari
- Subject: Re: Strange char "?" in html source from Safari
- From: Marco Trotta <email@hidden>
- Date: Mon, 30 Jul 2007 12:27:01 +0200
hi all,
Has, Mercoledì, 25 luglio 2007 ore 16:51:22 +0100
wrote all in "Re: Strange char "?" in html source from Safari"
>Didn't see the problem here, but at a guess you're using the Satimage
>osax which isn't Unicode-aware, so any characters that can't be
>represented in your system's primary encoding are converted to "?"
>instead. Try using a Unicode-aware alternative, e.g. TextCommands
><http://osaxen.com/files/textcommands1.1.2.html>, and see if that
>fixes the problem.
I think i've fixed in that way. Is right? Thanks. MT
on run
tell application "Safari" to copy ((source of front document) as Unicode text) to testo
set thefile to alias "Panther:private:tmp:prova.txt"
copy (open for access thefile with write permission) to nf
set eof of thefile to 0
write testo to thefile starting at eof
close access nf
do shell script ("iconv -f UTF-16 -t iso-8859-1 /tmp/prova.txt > /tmp/prova2.txt")
set foo to (open for access (file "Panther:private:tmp:prova2.txt"))
set testo to (read foo for (get eof foo))
close access foo
set dadove to (matchPos of (find text "<div class='articologirata'>" in testo)) + 29
set findove to matchPos of (find text "</div>" in testo starting at dadove)
set body to (extract string testo from dadove to findove)
set body to convert to Mac body
end run
_______________________________________________
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