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