We discussed the interface at the API Review meeting today. Based on the 
discussion and your suggestions, Brian will post a revised interface. 
Among other things, attributes will be used to represent 
defaultCharacterSetEncoding, documentCharacterSetEncoding and 
documentCharacterSetEncodingSource (real names to be decided by Brian). 
Regular wstrings will be used for the first two attributes and an 
enumeration will be used for the last.

--Vidur

Brendan Eich wrote:

> Brian Stell wrote:
> 
>> 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);
>> 
>>  };
> 
> 
> Shouldn't these be attributes (i.e., don't you want to support getting 
> the default and override c.s.e. values)?
> 
> How about doc comments for doxygen and future javadoc-style comment 
> extraction goodness.
> 
> Are atoms the right type for the c.s.e. names?  Would scripts want to 
> call this interface?  Color me curious, not anti-atom.
> 
> /be
> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
> 
> 
> 

Reply via email to