[Greasemonkey] Changing the charset of the document (and force re-rendering)

Prakash Kailasa pk-moz at kailasa.net
Thu Apr 21 09:39:27 EDT 2005


I am trying to change the charset of document whose meta tag is specified as:

<meta http-equiv="Content-Type" content="text/html; charset=x-user-defined">

This does not render parts of the document properly in Firefox, even
though the appropriate font is available. Changing the encoding (via
View -> Character Encoding) to "Western (Windows-1252)" re-renders the
page and fixes this problem.

I am trying to do this in a user script, but without luck.

I have tried setting the content attribute of the meta tag to the
appropriate value ("text/html; charset=windows-1252"), but it doesn't
make any difference, which I presume because the page is not rendered
after the user script change (I could be wrong, though).

The document.characterSet (readonly) property is unchanged after
running the script. However, if the encoding is changed via the menu,
it appears to be changed.

Any ideas to make the document re-render, or change the encoding
before it gets to rendering stage?

If you are interested, the site is http://gujaratsamachar.com (an
online newspaper in Gujarati -- a western indian language).

Thanks very much,
/prakash

-- 
|You're already carrying the sphere!                                   |


More information about the Greasemonkey mailing list