<?xml version="1.0" encoding="windows-1252"?>
<node id="977762" title="Re: Mapping ACCEPT_LANG, USER_AGENT &amp; GeoIP to Encode's character sets" created="2012-06-22 00:26:53" updated="2012-06-22 00:26:53">
<type id="11">
note</type>
<author id="248054">
Your Mother</author>
<data>
<field name="doctext">
&lt;p&gt;This might get you started–&lt;/p&gt;
&lt;code&gt;use strictures;
use Encode;

my $name = shift || die "Give an encoding!\n";

my $input = shift || "Some string...";

my $encoding = find_encoding($name)
    or die "No encoding found for $name\n";

binmode STDOUT, ":encoding(UTF-8)";

print $encoding-&gt;decode($input), $/;

__END__
&lt;/code&gt;
&lt;pre&gt;
perl pm-977749 MacIcelandic "OHAI &amp;#395;"
OHAI &amp;#8710;

perl pm-977749 MacRoman  "OHAI &amp;#395;"
OHAI &amp;#8710;

perl pm-977749 UTF-8 "OHAI &amp;#395;"
OHAI &amp;#65533;
&lt;/pre&gt;

&lt;p&gt;Basically, just &lt;c&gt;find_encoding&lt;/c&gt; as declared by client, rejecting unknowns or customizing to handle them,  and then decode. For customizing see the Pod for [mod://Encode] and realize that of the thousands of named encodings out there, they mostly line up with the stock list Encode is aware of, you just might have to do some mapping of your own; I seem to recall the EUC-KR set having several different names in various standards for example.&lt;/p&gt;</field>
<field name="root_node">
977749</field>
<field name="parent_node">
977749</field>
</data>
</node>
