[Mpls-pm] use open qw(:std :utf8); messes up readdir()?

Gerd Knops gerti-pm at bitart.com
Wed Apr 20 10:29:27 PDT 2011


Hi,

I have an application that deals with UTF8 data for most file I/O. So I am using the pragma

	use open qw(:std :utf8);

which seems to work fine for all data files written and read, as well as any STDIN/STDOUT stuff.

I also have some files on disk that use UTF8 file names (recent Ubuntu so should not be a problem). Bash displays them correctly as long as the 'LANG' environment indicates UTF8, for example "en_US.UTF-8". They also look fine when mounted on my MAC using sshfs.

Now oddly readdir() messes up the file names. When I read and print the names, they come out wrong wherever non ASCII characters are used, for example "Jürgen Müller".

When I comment out the "use open" pragma, readdir() shows the correct file names.

That seems backwards to me... Am I missing something, or is that a bug? perl v5.10.1

Thanks

Gerd



More information about the Mpls-pm mailing list