saveDocument converts ©

I need some Mozilla help:

My extension, Launchy, gives the user the ability to view the source of a webpage in an editor of the users choice. To do this I use the saveDocument function. But when I do this, HTML entities like fx © gets converted into a real copyright char.

I thought that if I just use the ENCODE_FLAGS_RAW flag it would work. But it doesn't seems to work.

My code:
const nsIWBP = Components.interfaces.nsIWebBrowserPersist;
var persist = Components.classes[";1"].createInstance(nsIWBP);
var encodingFlags = nsIWBP.ENCODE_FLAGS_RAW;
persist.saveDocument(doc, f, null, null, encodingFlags, 0);

Can anybody help? If you can, please can leave a comment here or add a comment to the bug report here.

You can test it yourself if you install my Launchy extension and then right click on a page and say Launchy -> View Source in blabla. Then the © symbol at the end of the source will be converted, which it shouldn't.

September 13, 2004 04:18 PM | Posted in Mozilla


Back Next


I came across this bug today:

Maybe it is relevant.

Comment by Nick Thomas at September 13, 2004 06:07 PM | Permalink

It seems that the solution is:

Site icon Comment by Henrik Gemal at September 13, 2004 09:44 PM | Permalink

Henrik, I think you might want to be passing in ENCODE_FLAGS_ENCODE_HTML_ENTITIES, not PERSIST_FLAGS_NO_CONVERSION. I don't have a way to test this really, but if you take a look at these lines it looks more like what you want:

NO_CONVERSION is not referenced anywhere in the saveDocument function, whereas ENCODE_HTML is. Hope this works for you!

Comment by Jon Henry at September 13, 2004 09:50 PM | Permalink

Post a comment

Remember Me?

Please enter the security code you see here

You're here: Home - saveDocument converts ©
Get the Mozilla Firefox browser