in reply to Convert strings with unknown encodings to html

as the others said, you have to know which encoding is used, otherwise you end up with Mojibake, which isn't half as delicious as it sounds …
  • Comment on Re: Convert strings with unknown encodings to html

Replies are listed 'Best First'.
Re^2: Convert strings with unknown encodings to html
by Pascal666 (Scribe) on Jul 01, 2015 at 02:30 UTC

    This does not appear to be correct. The very first reply suggested a module that will detect the encoding for each character individually. Graff also replied with a general outline for doing so. Using eval to catch when decode croaks was the main piece I was missing. It may sound obvious in hindsight, but my mind just wasn't getting there. I kept trying to figure out how to determine if it was safe to pass a string to decode.