Here is a rough draft:
Existing APIs:
1) set default charset
SetDefaultCharacterSet(const PRUnichar* aForceCharacterSet)
2) force charset override
SetForceCharacterSet(const PRUnichar* aForceCharacterSet)
or
SetForcedCharacterSet(const PRUnichar* aForceCharacterSet)
Note: this needs to be followed by a reload
3) find out what charset was used and how selected
GetDocumentCharacterSet(nsAWritableString& oCharSetID)
http://lxr.mozilla.org/seamonkey/source/intl/chardet/public/nsIDocumentCharsetInfo.idl
http://unstable.elemental.com/mozilla/build/latest/mozilla/intl/dox/class_nsIDocumentCharsetInfo.html
Proposed API:
interface nsIDocumentCharacterSetEncoding : nsISupports
{
/*
* Set fallback encoding
*/
void SetDefaultCharacterSetEncoding(in nsIAtom fallbackCharacterSetEncoding);
/*
* Force an override encoding
* (requires a reload to update display)
*/
void SetOverrideCharacterSetEncoding(in nsIAtom overrideCharacterSetEncoding);
/*
* Get encoding used for this page and from where
* (where: http header / meta tag / auto detect / fallback)
*/
nsIAtom GetCharacterSetEncoding(out nsIAtom characterSetEncodingFrom);
};