From 41ff45bb6da81971bf57c2230012e1d0b49b0c35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gon=C3=A9ri=20Le=20Bouder?= Date: Fri, 11 May 2012 12:00:38 +0200 Subject: [PATCH] W32: encode local filename unicode if possible 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 --- lib/FusionInventory/Agent/Task/Inventory.pm | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/FusionInventory/Agent/Task/Inventory.pm b/lib/FusionInventory/Agent/Task/Inventory.pm index 13dc0b040b..d6117450f0 100644 --- a/lib/FusionInventory/Agent/Task/Inventory.pm +++ b/lib/FusionInventory/Agent/Task/Inventory.pm @@ -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,