++ed by:
3 non-PAUSE users
Author image Michael Piotrowski

NAME

Text::Iconv - Perl interface to iconv() codeset conversion function

SYNOPSIS

  use Text::Iconv;
  $converter = Text::Iconv->new("fromcode", "tocode");
  $converted = $converter->convert("Text to convert");

DESCRIPTION

The Text::Iconv module provides a Perl interface to the iconv() function as defined by the Single UNIX Specification. The convert() method converts the encoding of characters in the input string from the fromcode codeset to the tocode codeset, and returns the result.

Settings of fromcode and tocode and their permitted combinations are implementation-dependent. Valid values are specified in the system documentation

ERRORS

If the conversion can't be initialized an exception is raised (using croak()).

As an experimental feature, this version of Text:Iconv provides a new class attribute raise_error and a corresponding class method for setting and getting its value. The handling of errors during conversion now depends on the setting of this attribute. If raise_error is set to a true value, an exception is raised; otherwise, the convert() method only returns undef. By default raise_error is false. Warnings are no longer emitted. Example usage:

  Text::Iconv->raise_error(1);     # Conversion errors raise exceptions
  Text::Iconv->raise_error(0);     # Conversion errors return undef
  $a = Text::Iconv->raise_error(); # Get current setting

Consult iconv(3) for details on errors that might occur.

Converting undef, e.g.,

  $converted = $converter->convert(undef);

always returns undef. This is not considered an error.

NOTES

The supported codesets, their names, the supported conversions, and the quality of the conversions are all system-dependent.

AUTHOR

Michael Piotrowski <mxp@dynalabs.de>

SEE ALSO

iconv(1), iconv(3)