in reply to Re^2: Saving file name with Chinese characters
in thread Saving file name with Chinese characters
That leaves getting a Perl handle from the Win32API::File object:
use strict; use warnings; use Encode qw( encode ); use Symbol qw( gensym ); use Win32API::File qw( CreateFileW OsFHandleOpen CREATE_ALWAYS GENERIC_WRITE ); my $qfn = chr(0x2660); # Whatever my $win32f = CreateFileW( encode('UCS-2le', $qfn), GENERIC_WRITE, # For writing 0, # Not shared [], # Security attributes CREATE_ALWAYS, # Create and replace 0, # Special flags [], # Permission template ) or die("CreateFile: $^E\n"); OsFHandleOpen( my $fh = gensym(), $win32f, 'w' ) or die("OsFHandleOpen: $^E\n"); print $fh "Foo!\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Saving file name with Chinese characters
by Anonymous Monk on Apr 14, 2009 at 03:42 UTC | |
by ikegami (Patriarch) on Apr 14, 2009 at 04:10 UTC |