[Catalyst] Re: decoding in core
Peter Karman
peter at peknet.com
Mon Feb 23 15:54:42 GMT 2009
Neo [GC] wrote on 02/23/2009 09:41 AM:
> Does anyone know a _safe_ method to convert _any_ string-scalar to utf8?
> Something like
> anything_to_utf8($s)
> , regardless if $s contains ascii, latin1, utf8, tasty hodgepodge or hot
> fn0rd, utf8-flag is set or not and is neither affected by full moon nor
> my horrorscope, _without_ doing double-encoding (there MUST be some way
> to determine if it already is utf8... my silly java editor can do it and
> perl makes difficult things at least possible).
>
>
> I would greatly appreciate this philosophers stone and will send my hero
> a bottle of finest bavarian (munich!) beer called Edelstoff ("precious
> stuff" - tasty).
>
Search::Tools::UTF8::to_utf8() comes close. It won't handle mixed
encoding in a single string (which would be garbage anyway) but it does
try to prevent double-encoding and uses the Encode goodness under the hood.
--
Peter Karman . peter at peknet.com . http://peknet.com/
More information about the Catalyst
mailing list