Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I need to save these files to a Windows server. And I must keep their original names.
Is it necessary for Perl to know the language of the string? Is it possible to "sniff out" the language?
Thanks for any ideas on how to implement this. ikegami has already provided much help with this code:
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(0x263a); # 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: Converting East Asian strings
by CountZero (Bishop) on Apr 14, 2009 at 05:49 UTC | |
by ikegami (Patriarch) on Apr 14, 2009 at 06:05 UTC | |
|
Re: Converting East Asian strings
by Lu. (Hermit) on Apr 14, 2009 at 13:39 UTC | |
|
Re: Converting East Asian strings
by Burak (Chaplain) on Apr 14, 2009 at 18:02 UTC | |
by Corion (Patriarch) on Apr 14, 2009 at 18:36 UTC | |
by almut (Canon) on Apr 14, 2009 at 19:38 UTC |