2001-09-26 04:40:45 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
1999-09-21 04:17:37 +04:00
|
|
|
|
|
|
|
#include "nsISupports.idl"
|
|
|
|
|
|
|
|
|
|
|
|
%{C++
|
|
|
|
// {8B042E22-6F87-11d3-B3C8-00805F8A6670}
|
1999-09-21 09:13:53 +04:00
|
|
|
#define NS_TEXTTOSUBURI_CID { 0x8b042e22, 0x6f87, 0x11d3, { 0xb3, 0xc8, 0x0, 0x80, 0x5f, 0x8a, 0x66, 0x70 } }
|
2000-09-14 03:57:52 +04:00
|
|
|
#define NS_ITEXTTOSUBURI_CONTRACTID "@mozilla.org/intl/texttosuburi;1"
|
1999-09-21 04:17:37 +04:00
|
|
|
%}
|
|
|
|
|
|
|
|
[scriptable, uuid(8B042E24-6F87-11d3-B3C8-00805F8A6670)]
|
|
|
|
interface nsITextToSubURI : nsISupports
|
|
|
|
{
|
2017-04-27 13:27:03 +03:00
|
|
|
ACString ConvertAndEscape(in ACString charset, in AString text);
|
|
|
|
AString UnEscapeAndConvert(in ACString charset, in ACString text);
|
2002-08-12 23:23:22 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Unescapes the given URI fragment (for UI purpose only)
|
2017-04-27 13:27:03 +03:00
|
|
|
* Note:
|
2005-02-22 21:25:12 +03:00
|
|
|
* <ul>
|
2017-04-27 13:27:03 +03:00
|
|
|
* <li> escaping back the result (unescaped string) is not guaranteed to
|
2005-02-22 21:25:12 +03:00
|
|
|
* give the original escaped string
|
2017-04-27 13:27:03 +03:00
|
|
|
* <li> In case of a conversion error, the URI fragment (escaped) is
|
2005-02-22 21:25:12 +03:00
|
|
|
* assumed to be in UTF-8 and converted to AString (UTF-16)
|
2014-12-01 18:55:15 +03:00
|
|
|
* <li> In case of successful conversion any resulting character listed
|
2018-11-24 01:40:29 +03:00
|
|
|
* in netwerk/dns/IDNCharacterBlocklist.inc (except space) is escaped
|
2005-02-22 21:25:12 +03:00
|
|
|
* <li> Always succeeeds (callers don't need to do error checking)
|
|
|
|
* </ul>
|
2002-08-12 23:23:22 +04:00
|
|
|
*
|
|
|
|
* @param aCharset the charset to convert from
|
|
|
|
* @param aURIFragment the URI (or URI fragment) to unescape
|
|
|
|
* @return Unescaped aURIFragment converted to unicode
|
|
|
|
*/
|
|
|
|
AString unEscapeURIForUI(in ACString aCharset, in AUTF8String aURIFragment);
|
2002-09-08 19:08:21 +04:00
|
|
|
|
|
|
|
/**
|
2017-04-27 13:27:03 +03:00
|
|
|
* Unescapes only non ASCII characters in the given URI fragment
|
|
|
|
* note: this method assumes the URI as UTF-8 and fallbacks to the given
|
|
|
|
* charset if the charset is an ASCII superset
|
2002-09-08 19:08:21 +04:00
|
|
|
*
|
|
|
|
* @param aCharset the charset to convert from
|
|
|
|
* @param aURIFragment the URI (or URI fragment) to unescape
|
|
|
|
* @return Unescaped aURIFragment converted to unicode
|
|
|
|
* @throws NS_ERROR_UCONV_NOCONV when there is no decoder for aCharset
|
2017-04-27 13:27:03 +03:00
|
|
|
* or NS_ERROR_UDEC_ILLEGALINPUT in case of conversion failure
|
2002-09-08 19:08:21 +04:00
|
|
|
*/
|
|
|
|
AString unEscapeNonAsciiURI(in ACString aCharset, in AUTF8String aURIFragment);
|
1999-09-21 04:17:37 +04:00
|
|
|
};
|