1Iconv(3)              User Contributed Perl Documentation             Iconv(3)
2
3
4

NAME

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

SYNOPSIS

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

DESCRIPTION

14       The Text::Iconv module provides a Perl interface to the iconv() func‐
15       tion as defined by the Single UNIX Specification.  The convert() method
16       converts the encoding of characters in the input string from the from‐
17       code codeset to the tocode codeset, and returns the result.
18
19       Settings of fromcode and tocode and their permitted combinations are
20       implementation-dependent.  Valid values are specified in the system
21       documentation
22
23       As an experimental feature, this version of Text::Iconv objects provide
24       the retval() method:
25
26         $result = $converter->convert("lorem ipsum dolor sit amet");
27         $retval = $converter->retval;
28
29       This method can be called after calling convert().  It returns the
30       return value of the underlying iconv() function for the last conver‐
31       sion; according to the Single UNIX Specification, this value indicates
32       "the number of non-identical conversions performed."  Note, however,
33       that iconv implementations vary widely in the interpretation of this
34       specification.
35
36       When called before the first call to convert(), or if an error occured
37       during the conversion, retval() returns undef.
38

ERRORS

40       If the conversion can't be initialized an exception is raised (using
41       croak()).
42
43       Handling of conversion errors
44
45       Text::Iconv provides a class attribute raise_error and a corresponding
46       class method for setting and getting its value.  The handling of errors
47       during conversion depends on the setting of this attribute.  If
48       raise_error is set to a true value, an exception is raised; otherwise,
49       the convert() method only returns undef.  By default raise_error is
50       false.  Example usage:
51
52         Text::Iconv->raise_error(1);     # Conversion errors raise exceptions
53         Text::Iconv->raise_error(0);     # Conversion errors return undef
54         $a = Text::Iconv->raise_error(); # Get current setting
55
56       Per-object handling of conversion errors
57
58       As an experimental feature, Text::Iconv also provides an instance
59       attribute raise_error and a corresponding method for setting and get‐
60       ting its value.  If raise_error is undef, the class-wide settings
61       apply.  If raise_error is 1 or 0 (true or false), the object settings
62       override the class-wide settings.
63
64       Consult iconv(3) for details on errors that might occur.
65
66       Conversion of undef
67
68       Converting undef, e.g.,
69
70         $converted = $converter->convert(undef);
71
72       always returns undef.  This is not considered an error.
73

NOTES

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

AUTHOR

79       Michael Piotrowski <mxp@dynalabs.de>
80

SEE ALSO

82       iconv(1), iconv(3)
83
84
85
86perl v5.8.8                       2004-07-17                          Iconv(3)
Impressum