[Greasemonkey] ISO-8859 / UTF conversion with GM_xmlhttprequest

Paul Bardo greasemonkey at otherlies.com
Mon Jan 23 09:43:48 EST 2006


Hello,

I am writing a script that will use GM_xmlhttprequest to call a page
and embed some content from that page into the page I am viewing.

Occasionally, quotes and apostrophes and various other characters from
the document I am pulling from should up as weird question mark
symbols in the document I am embedding into.  I am pretty sure that
this is because the page I am pulling is 'ISO-8859-1' but the page I
am embedding into is 'UTF-8'

I tried adding "headers: {'Accept-Charset': 'UTF-8'}" to my
GM_xmlhttprequest call, but it didn't seem to help.  ( I was hoping
that would coerce the web server to convert to UTF before servering
the page, but I guess not)

I don't know a whole lot about charsets, but I was under the
impression that UTF was a superset of ISO-8859, so I'm a little
surprised to be having this problem.  But there is probably something
I am misunderstanding.

Please forgive me if this isn't a true greasemonkey problem.  I know
that xmlhttprequest is a regular javascript function, but as I
understand it, the javascript function can't pull pages from domains
other than the one originating the call, so this conversion problem
doesn't seem to come up.  I have search around in Google for an answer
but I haven't found one that works.

Thanks for any help you can provide,
Paul Bardo


More information about the Greasemonkey mailing list