I have several domain names saved in database in idn format (“xn--“). I want to run some statistics queries, but have problem to count characters on these domain names
SELECT
dom_name,
char_length(dom_name) as raw_length, -- counted with zone extension for now
FROM
my_domains_table;
Ofcourse i have mistake about “xn--” domains, and i wanted to get count from sql (not using php further or some other language).
Or, please, give me some advice how to do it better.
–
In first save domain names into table in UTF-8 would be great, but this is not an option right now 🙂
If you can install untrusted languages to your database, like
PL/PerlUorPL/PythonU, then you can createpunycode_decodefunction usingNet::IDN::Encodeperl module ordecode('idna')python string class member function.If you don’t, then you’d need to implement it using pl/pgsql, which won’t be easy.