v.21.7Improvement

Fix topLevelDomain for IDN hosts to prevent returning empty strings

Fix topLevelDomain for IDN hosts (i.e. example.рф), before it returns empty string for such hosts. #25103 (Azat Khuzhin).
Fixes the topLevelDomain function to correctly return top-level domains for Internationalized Domain Name (IDN) hosts, such as those with non-ASCII characters (e.g., example.рф), instead of returning an empty string.

Why it matters

Previously, the topLevelDomain function failed to handle IDN hosts, resulting in empty strings for valid domains with international characters. This fix ensures accurate domain parsing and improves the function's reliability for globalized domain names, which is valuable for users dealing with international web data.

How to use it

Users can use the topLevelDomain function as usual in their queries. The fix is applied internally, so no changes in usage or configuration are needed. After upgrading ClickHouse to the version containing this fix, the function will return correct top-level domains for IDN hosts automatically.