nsresult ConvertPrefToUTF8(const char *prefname, nsIPref *prefs, const char* charSet)
nsresult ConvertPrefToUTF8(const char *prefname, nsIPrefBranch *prefs, const char* charSet)
nsresult ConvertPrefToUTF8(const char *prefname, nsIPref *prefs, const char* charSet){  nsresult rv;  if (!prefname || !prefs) return NS_ERROR_FAILURE;    nsXPIDLCString prefval;  rv = prefs->CopyCharPref(prefname, getter_Copies(prefval));  if (NS_FAILED(rv)) return rv;  if (prefval.IsEmpty())     return NS_OK;  nsXPIDLCString outval;  rv = ConvertStringToUTF8(charSet, (const char *)prefval, getter_Copies(outval));  // only set the pref if the conversion worked, and it convert to something non null  if (NS_SUCCEEDED(rv) && (const char *)outval && PL_strlen((const char *)outval))     rv = prefs->SetCharPref(prefname, (const char *)outval);  return NS_OK;}