你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
punycode_from_string()
Applies to: ✅ Microsoft Fabric ✅ Azure Data Explorer ✅ Azure Monitor ✅ Microsoft Sentinel
Encodes input string to Punycode form. The result string contains only ASCII characters. The result string doesn't start with "xn--".
Syntax
punycode_from_string('input_string')
Learn more about syntax conventions.
Parameters
Name | Type | Required | Description |
---|---|---|---|
input_string | string |
✔️ | A string to be encoded to punycode form. The function accepts one string argument. |
Returns
- Returns a
string
that represents punycode-encoded original string. - Returns an empty result if encoding failed.
Examples
print encoded = punycode_from_string('académie-française')
encoded |
---|
acadmie-franaise-npb1a |
print domain='艺术.com'
| extend domain_vec = split(domain, '.')
| extend encoded_host = punycode_from_string(tostring(domain_vec[0]))
| extend encoded_domain = strcat('xn--', encoded_host, '.', domain_vec[1])
domain | domain_vec | encoded_host | encoded_domain |
---|---|---|---|
艺术.com | ["艺术","com"] | cqv902d | xn--cqv902d.com |
Related content
- Use punycode_to_string() to retrieve the original decoded string.