Skip to content

Commit

Permalink
W32: encode local filename unicode if possible
Browse files Browse the repository at this point in the history
if Win32::Unicode::File::open() is available, we use it to create
the file name. This is useful for the rare cases when the computer
name if in a local encoding.

closes: #272
  • Loading branch information
Gonéri Le Bouder authored and guillomovitch committed May 15, 2012
1 parent 37dfcd0 commit 41ff45b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/FusionInventory/Agent/Task/Inventory.pm
Expand Up @@ -89,7 +89,14 @@ sub run {
$self->{deviceid} .
$extension;

if (open my $handle, '>', $file) {
my $handle;
if (Win32::Unicode::File->require) {
$handle = Win32::Unicode::File->new('w', $file);
} else {
open($handle, '>', $file);
}

if ($handle) {
$self->_printInventory(
inventory => $inventory,
handle => $handle,
Expand Down

0 comments on commit 41ff45b

Please sign in to comment.