1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #include
"nsISupports.idl"
8 * nsIIDNService interface.
10 * IDN (Internationalized Domain Name) support. Provides facilities
11 * for manipulating IDN hostnames according to the specification set
15 * http://www.ietf.org/html.characters/idn-charter.html
16 * http://www.i-dns.net
19 * http://search.ietf.org/internet-drafts/draft-ietf-idn-idna-06.txt
22 [scriptable
, uuid(a592a60e
-3621
-4f19
-a318
-2bf233cfad3e
)]
23 interface nsIIDNService
: nsISupports
26 * Prepares the input hostname according to IDNA ToASCII operation,
27 * the input hostname is assumed to be UTF8-encoded.
29 ACString convertUTF8toACE
(in AUTF8String input
);
33 * This is the ToUnicode operation as specified in the IDNA proposal,
34 * with an additional step to encode the result in UTF-8.
35 * It takes an ACE-encoded hostname and performs ToUnicode to it, then
36 * encodes the resulting string into UTF8.
38 AUTF8String convertACEtoUTF8
(in ACString input
);
41 * Checks if the input string is ACE encoded or not.
43 boolean isACE
(in ACString input
);
46 * Performs the unicode normalization needed for hostnames in IDN,
47 * for callers that want early normalization.
49 AUTF8String normalize
(in AUTF8String input
);
52 * Normalizes and converts a host to UTF-8 if the host is in the IDN
53 * whitelist, otherwise converts it to ACE. This is useful for display
54 * purposes and to ensure an encoding consistent with nsIURI::GetHost().
55 * If the result is ASCII or ACE encoded, |isASCII| will be true.
57 AUTF8String convertToDisplayIDN
(in AUTF8String input
, out boolean isASCII
);