Character set sucktitude

Chisel Wright chisel at herlpacker.co.uk
Tue May 22 10:11:28 BST 2007


On Mon, May 21, 2007 at 11:58:41PM +0100, David Cantrell wrote:
> I have some data that is unfortunately in "Western (Mac OS Roman)",
> whatever the fuck that is.  I need to turn it into ISO-8859-1.  Ideally,
> I don't want to be able to only do the conversion on a Mac, but if I
> have to then so be it.
> 
> How?

I had a great way of doing this at my last place:

  use Matt::Lawrence;

it always worked a treat.


These days I think I tend to do something along the lines of:

  $foo = encode(
     $to_charset,
	 decode($from_charset, $string, FB_CROAK),
     FB_CROAK
  );

or something like that.

Usually I prefer to just use iconv though.
-- 
Chisel Wright
e: chisel at herlpacker.co.uk
w: http://www.herlpacker.co.uk/

  print $signatures[ rand(@signatures) ];


More information about the london.pm mailing list