Skip Menu |
 

This queue is for tickets about the Encode CPAN distribution.

Report information
The Basics
Id: 7966
Status: resolved
Priority: 0/
Queue: Encode

People
Owner: DANKOGAI [...] cpan.org
Requestors: cubic [...] acronis.ru
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: (no value)



Subject: Docs clearness
Download (untitled) / with headers
text/plain 738b
<<< Handling Malformed Data The CHECK argument is used as follows. When you omit it, the behaviour is the same as if you had passed a value of 0 for CHECK. Show quoted text
>>>
Please add note that FB_DEFAULT is used when call has no CHECK argument, for eg. Encode::from_to. Confusing thing is "from_to() returns the length of the converted string in octets on success, undef otherwise". otherwise? when? May be next code should return undef, not it dies: perl -MEncode -e 'my $str = "\x{442}\x{435}\x{441}\x{442}";Encode::from_to($str, "utf8"=> "us-ascii");' Is it hard to add fallbacks to from_to call? If it is, then please add described example how to convert octets from one encoding to another with fallbacks on errors. Regards, Ruslan Zakirov
Download (untitled) / with headers
text/plain 1.7k
Thanks for your report. Addressed in my repository as follows. Hope it is less confusing. Dan the Encode Maintainer ========================================================= ========== RCS file: Encode.pm,v retrieving revision 2.5 diff -u -r2.5 Encode.pm --- Encode.pm 2004/10/19 04:54:43 2.5 +++ Encode.pm 2004/10/19 22:08:07 @@ -1,5 +1,5 @@ # -# $Id: Encode.pm,v 2.5 2004/10/19 04:54:43 dankogai Exp dankogai $ +# $Id: Encode.pm,v 2.5 2004/10/19 04:54:43 dankogai Exp $ # package Encode; use strict; @@ -429,7 +429,8 @@ Converts B<in-place> data between two encodings. The data in $octets must be encoded as octets and not as characters in Perl's internal -format. For example, to convert ISO-8859-1 data to Microsoft's CP1250 encoding: +format. For example, to convert ISO-8859-1 data to Microsoft's CP1250 +encoding: from_to($octets, "iso-8859-1", "cp1250"); @@ -440,8 +441,8 @@ Note that because the conversion happens in place, the data to be converted cannot be a string constant; it must be a scalar variable. -from_to() returns the length of the converted string in octets on success, undef -otherwise. +from_to() returns the length of the converted string in octets on +success, I<undef> on error. B<CAVEAT>: The following operations look the same but are not quite so; @@ -555,9 +556,12 @@ =head1 Handling Malformed Data -The I<CHECK> argument is used as follows. When you omit it, -the behaviour is the same as if you had passed a value of 0 for -I<CHECK>. +The optional I<CHECK> argument is used as follows. When you omit it, +Encode::FB_DEFAULT is assumed. + +B<Note:> Not all encoding suppport this feature. Some encodings +ignore I<CHECK> argument. For example, L<Encode::Unicode> ignores +I<CHECK> and it always croaks on error. =over 2


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.