perl-unicode

tr// for conversion

1999-06-14 19:08:08


Is there any way that we could use tr/// to do 8-bit to Unicode conversions
simply? I am invisaging something like:

tr/[\x80-\x9f]/\x20ac\x..../U;

or the like whereby the lhs of the tr is considered in binary and the rhs in
UTF-8. Likewise for reverse conversion you could have UTF8 on the lhs and 8-bit
clean on the rhs. The only difficulty here is that you would want an extra code
on the rhs to be used for the 'out of range' code (what happens when a code >256
isn't matched and converted, you want a default character inserted rather than
the thing deleted).

Or has this already been done?

Martin




<Prev in Thread] Current Thread [Next in Thread>