-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Hi,
Le 27/09/2012 07:55, D. Barbier a écrit :
Indeed, this is due to accented characters.
It seems that length() returns the number of bytes and not characters.
I looked at Unicode issues with Perl a very long time ago and do not
remember about its quirks; if anyone has a clue, please tell ;-)
Thomas, CCed, helped us a lot for the DPNhtml2mail script [0], and
managed to make that work.
I guess the magic operates in the end of the following code:
# number of column of a string
sub _columns {
my $str = scalar shift;
return 0 if ( !defined $str || $str eq '' );
$str = decode_utf8($str) unless utf8::is_utf8($str);
return Unicode::GCString->new($str)->columns();
}
Regards
David
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
iQIcBAEBCAAGBQJQZEWNAAoJELgqIXr9/gnydtcQAIAWJTSr7dWxAJwwpb/Ap5sM
xlrbUFfy9V5LGJDq9rkr4WX5Bx4rUI+UBCDo9JONnN1+xtx3gGDlxgXu4l25MKI8
SsMIgNJMrg1CtkGl0qK1ZZauKm1H8H1PFvWCfqDsBStVyhxlGkkfXcwGcvSr1jA0
F1ALvGhYTGW1VWnM+Je+7CJ+pWLiff/I0oJgG3SSSypQoDvQ/pT3WqrkRB2F8ikT
28Ps2WMEhu9gIO50xd9wi2uWy6/3mtEkLu9KXHDZ4OLfKl1uplah9qX075mIkpog
uC1sY34yvxbC03Sx+I+e5yHqA6OdRD/o2U0NjBAaj0ztjiapwLhVeJ3h7Zi8p9Ij
CMgNEkIZXEWgGutApIgCF3p5ouZqjq+iFeInO+A1UgwLyqpz6zp4zDQ8waBrAkxT
1GffRB11uI6zMlnmI2FAT4PYEt5cj2bUZicuUVIbHeiQM+yoWAIHfTcpM0G6+p2L
UCchJTMrkZxxBBAuTz/r2mfyfMH7F7T/MCLsm8w9GYBnrLpJdfpueTFCMhb150U4
AHk1C4Q45g7PKDGV6PAYp/xVl+Aa0fpGmoW452WKe1MKBflUd56sLWIhQ9etxB3b
NrqmFJ7ElatsBtsWm1QvJN8/B5GLtcbKLcJnH2U/DaVqfRTCBGKzzqmOmVPhdhcR
H+rYobXZNGOXK/Wpu4cn
=RczU
-----END PGP SIGNATURE-----