Package: perl Version: 5.8.8-7 Severity: normal [EMAIL PROTECTED]:~>LANG=fr_FR.UTF-8 perl -e 'use open qw{:utf8 :std};open(foo) || print STDERR "error: $!\n";' error: Aucun fichier ou répertoire de ce type ^^ This mojibake comes about because $! is a UTF-8 string in that locale, but it is not decoded into perl's internal utf8 representation.
It's possible to work around the problem with the encoding pragma, but not completely: [EMAIL PROTECTED]:~>LANG=fr_FR.UTF-8 perl -e 'use open qw{:utf8 :std}; use encoding 'utf8';open(foo) || print STDERR "error: $!\n";' error: Aucun fichier ou répertoire de ce type [EMAIL PROTECTED]:~>LANG=fr_FR.UTF-8 perl -e 'use open qw{:utf8 :std}; use encoding 'utf8';open(foo) || print STDERR "error: ",$!,"\n";' error: Aucun fichier ou répertoire de ce type The first example works because the encoding pragma converts the string to utf8 during concacenation, but the second example shows that this is not a solution because concacentation can't be relied on for all output. The only solution if you want to use open qw{:utf8 :std} in a program seems to be manually using Encode::decode_utf8 on every instance of $! and $@ in the program. Which is exactly the kind of error-prone busywork that IO layers and perl's unicode model are supposed to avoid.. -- System Information: Debian Release: 4.0 APT prefers unstable APT policy: (500, 'unstable'), (500, 'testing'), (1, 'experimental') Architecture: i386 (i686) Shell: /bin/sh linked to /bin/bash Kernel: Linux 2.6.18-4-686 Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Versions of packages perl depends on: ii libc6 2.3.6.ds1-10 GNU C Library: Shared libraries ii libdb4.4 4.4.20-8 Berkeley v4.4 Database Libraries [ ii libgdbm3 1.8.3-3 GNU dbm database routines (runtime ii perl-base 5.8.8-7 The Pathologically Eclectic Rubbis ii perl-modules 5.8.8-7 Core Perl modules Versions of packages perl recommends: ii perl-doc 5.8.8-7 Perl documentation -- no debconf information -- see shy jo
signature.asc
Description: Digital signature