in reply to Re: Problems Opening file with Perl where path has UTF8
in thread Problems Opening file with Perl where path has UTF8
一棵高树#!/usr/bin/perl use strict; use Win32API::File qw( :ALL ); use utf8; use Encode; #Notice the \0 at the end of the file name. Necessary but I don't kno +w why. my $win32_handle = Win32API::File::CreateFileW(Encode::encode("UTF-16L +E", "C:\\test\\" . "
" . "\\test.txt\0"), FILE_READ_DATA, 0, [], OPEN_EXISTING, 0, []); my $perl_handle = 0; #This translates the win32 file handle to a Perl file handle Win32API::File::OsFHandleOpen($perl_handle, $win32_handle, "r"); print <$perl_handle>; if ($^E) { print "Error: " . $^E }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Problems Opening file with Perl where path has UTF8
by ikegami (Patriarch) on Nov 24, 2006 at 21:41 UTC |