Encode::Registry - Registry file handling for character encodings
use Encode::Registry; $enc = Encode::Registry->find_encoding($enc_name); $uni_str = $enc->decode($byte_str); $byte_str = $enc->encode($uni_str);
Encode module provides a Perl interface to the cross-architecture registry of character encoding information. This registry takes the form of an XML file containing information about encoding files, their types and handlers for different file types on different platforms (or programming environments).
Having a central registry for encodings is very useful, assuming you can find it. But tracking down such a registry given that it may be shared by many programming environments, is not easy.
On the Windows platform, this module will look for the registry file in the system registry under the following key
which is held as a string.
Failing this, and on other systems, the module will examine the
MAPPINGPATH environment variable and look in each directory listed for a file
REGISTRY.xml. Directories in the environment variable are separated by a ;
To use the module, simply
This will cause the
import subroutine to run which will search for a REGISTRY.xml and read it. If nothing is found, then nothing will be read.
To load the highest priority implementation of an encoding, use:
$enc = Encode::Registry->find_encoding($enc_name); $utf8 = $enc->decode($bytes); $bytes = $enc->encode($utf8);
Returns an absolute file name reference to the registry file, if it can find it.
Reads and processes the given XML file adding the information to the internal data structures of this class.
Returns an object capable of processing data of the given encoding. The object is created by calling
$handler is the associated handler for the given file type of
$handler with the highest priority is chosen.
Adds the given type to be handled by the handler module when using Perl. The priority is also set this way.