public string NativeToPunycode(string domain) { string sld = null; string tld = null; string converted = null; DomainParser parser = null; if (null == domain) { return(null); } try { parser = new DomainParser(m_tldCache); // parse the domain. this.Parse(parser, domain, ref sld, ref tld); // convert it converted = m_punyConverter.Encode(sld); if (null != tld) { converted += "." + tld; } } catch (Exception e) { converted = null; EventLogger.Log(EVENT_SOURCE, EventLogger.LogType.Error, e.ToString()); } // Done. return(converted); }