Skip Menu |

This queue is for tickets about the XML-TreePP CPAN distribution.

Report information
The Basics
Id: 87863
Status: new
Priority: 0/
Queue: XML-TreePP

People
Owner: Nobody in particular
Requestors: victor [...] vsespb.ru
Cc:
AdminCc:

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



Subject: possible issue with utf8
if ( $ALLOW_UTF8_FLAG && utf8::is_utf8( $text ) ) { utf8::encode( $text ); } This code won't work correctly with downgraded Latin1 strings. In the example below f1() represent a way that most Perl core function work with unicode. and f2() represent a way your code works with it. Results are different for downgraded Latin1 characters (but same for other characters) use utf8; use Devel::Peek; my $text = "\xB5"; sub f1 { my $s = shift; open my $f, ">", "file1.tmp"; binmode $f, ":encoding(utf-8)"; print $f $s; close $f; } sub f2 { my $s = shift; if (utf8::is_utf8( $s ) ) { utf8::encode( $s ); } open my $f, ">", "file2.tmp"; print $f $s; close $f; } f1($text); f2($text);