in reply to Convert international characters to plain ASCII
An alternative might be to use Punycode. This is an ASCII-compatible encoding for Unicode. It essentially strips out non-ASCII characters, and adds a bunch of base64-like crud to the end of the string.
perl -Mutf8::all -MEncode -MEncode::Punycode -E'say encode(Punycode => + "It cost me €200!")'
It's not as pretty as the technique you suggest, but has the advantage of being completely reversible. (i.e. you can decode it and back the original string.)
Punycode happens to be the encoding used to store non-ASCII names in the DNS, and so it is best known for just encoding domain names. However it can in fact be applied to arbitrary Unicode strings.
|
|---|