Bric::Util::CharTrans(User Contributed Perl DocumentaBric::Util::CharTrans(3p)



NAME
       Bric::Util::CharTrans - Interface to Bricolage UTF-8 Character
       Translations

VERSION
       $LastChangedRevision$

DATE
       $LastChangedDate: 2005-10-05 00:22:53 +0200 (Wed, 05 Oct 2005) $

SYNOPSIS
         # Constructors.
         my $chartrans = Bric::Util::CharTrans->new('iso-8859-1');

         # Instance Methods.
         my $charset     = $chartrans->charset;
         my $charset     = $chartrans->charset('iso-8859-1');

         # (note: this is only in-place now -- it used to also return the string)
         $chartrans->to_utf8(\$some_data);
         $chartrans->from_utf8(\$some_data);

DESCRIPTION
       Bric::Util::CharTrans provides an object-oriented interface to
       conversion of characters from a target character set to Unicode UTF-8
       and from Unicode UTF-8 to a target character set.

INTERFACE
   Constructors
       my $chartrans = Bric::Util::CharTrans->new($charset)
           Throws:

           o   Unspecified charset

           o   Unknown charset

           Side Effects:

           Notes: Use new() to get a working CharTrans object.

   Public Class Methods
       None.

   Public Instance Methods
       my $charset = $chartrans->charset;
       $chartrans = $chartrans->charset($new_charset);
           Gets the current target character set in use.

           Optionally sets the current character set.

           Throws: NONE.

           Side Effects: NONE.

           Notes: NONE.

       $chartrans = $chartrans->to_utf8($somedata);
           Performs an in-place conversion of the data in $somedata from the
           character set specified via "charset()" to UTF-8. References to
           SCALARs, ARRAYs, and HASHes will be recursively processed and their
           data replaced.

           Throws:

           Error converting data from [charset] to utf-8.

           Side Effects: NONE.

           Notes:

           This used to return the converted string, but it doesn't any more.
           Instead, it returns the Bric::Util::CharTrans object itself.

       my $target_text = $chartrans->from_utf8($utf8_text);
           Performs an in-place conversion of the UTF-8 data in $utf8_text to
           the character set specified via "charset()". References to SCALARs,
           ARRAYs, and HASHes will be recursively processed and their data
           replaced.

           Throws:

           Error converting data from utf-8 to [charset].

           Side Effects: NONE.

           Notes:

           This used to return the converted string, but it doesn't any more.
           Instead, it returns the Bric::Util::CharTrans object itself.



perl v5.12.2                      2005-10-04         Bric::Util::CharTrans(3p)
