nsresult CSSLoaderImpl::SetCharset( const char* aStyleSheetData,  PRUint32 aDataLength)
NS_IMETHODIMP CSSLoaderImpl::SetCharset( const nsAString &aCharsetSrc)
nsresult CSSLoaderImpl::SetCharset(/*in*/ const char* aStyleSheetData,                                   /*in*/ PRUint32 aDataLength)    // sets the charset based upon the data passed in    // - if the StyleSheetData is not empty and it has '@charset'    //   as the first substring, then use that    // - otherwise return an error{  nsresult rv = NS_ERROR_NOT_AVAILABLE;  nsString strStyleDataUndecoded;  strStyleDataUndecoded.AssignWithConversion(aStyleSheetData, aDataLength);  PRInt32 charsetOffset;  if (!strStyleDataUndecoded.IsEmpty()) {    nsString str;    static const char atCharsetStr[] = "@charset";    if ((charsetOffset = strStyleDataUndecoded.Find(atCharsetStr)) > -1) {      nsString strValue;      // skip past the ident      strStyleDataUndecoded.Right(str, strStyleDataUndecoded.Length() -                                  (sizeof(atCharsetStr)-1));      // strip any whitespace      str.StripWhitespace();      // truncate everything past the delimiter (semicolon)      PRInt32 pos = str.Find(";");      if (pos > -1) {        str.Left(strValue,pos);      }      // strip any quotes      strValue.Trim("\"\'");      // that's the charset!      if (!strValue.IsEmpty()) {        rv = SetCharset(strValue);      }    }  }  return rv;}