Skip to content

Commit

Permalink
Merge branch '2.2.x' into 2.2.x-without-charset-changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Gonéri Le Bouder committed May 22, 2012
2 parents cfbd147 + 6aefa34 commit c07208b
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Changes
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ General:
* replace IS64BIT software property with more general ARCH property (#1581)
* sync EDID parsing code with mandriva
* more EDID manufacturer codes
* various UTF8 encoding fixes

Windows:
* various encoding issues (#1550)
* network addresses collecting failure (#1549)
* inventory all the KB on Win Vista/7 (#1668, #197, #706)
* upgrade Net::SNMP (#1666)
* Store the XML file with the local codepage (#272)

Virtualization:
Expand Down
2 changes: 1 addition & 1 deletion lib/FusionInventory/Agent.pm
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use FusionInventory::Agent::Tools;
use FusionInventory::Agent::Tools::Hostname;
use FusionInventory::Agent::XML::Query::Prolog;

our $VERSION = '2.2.0';
our $VERSION = '2.2.1';
our $VERSION_STRING =
"FusionInventory unified agent for UNIX, Linux and MacOSX ($VERSION)";
our $AGENT_STRING =
Expand Down
3 changes: 2 additions & 1 deletion lib/FusionInventory/Agent/HTTP/Client/OCS.pm
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use English qw(-no_match_vars);
use HTTP::Request;
use UNIVERSAL::require;
use URI;
use Encode;

use FusionInventory::Agent::Tools;
use FusionInventory::Agent::XML::Response;
Expand Down Expand Up @@ -61,7 +62,7 @@ sub send { ## no critic (ProhibitBuiltinHomonyms)
my $request_content = $message->getContent();
$logger->debug2($log_prefix . "sending message:\n $request_content");

$request_content = $self->_compress($request_content);
$request_content = $self->_compress(encode('UTF-8', $request_content));
if (!$request_content) {
$logger->error($log_prefix . 'inflating problem');
return;
Expand Down
6 changes: 6 additions & 0 deletions lib/FusionInventory/Agent/Task/Inventory/Input/Win32/User.pm
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ use Win32::TieRegistry (
qw/KEY_READ/
);

Win32::OLE->Option(CP => Win32::OLE::CP_UTF8);


use FusionInventory::Agent::Tools::Win32;

my $seen;
Expand Down Expand Up @@ -52,6 +55,9 @@ sub doInventory {
DOMAIN => $domain->Get()
};

utf8::upgrade($user->{LOGIN});
utf8::upgrade($user->{DOMAIN});

next if $seen->{$user->{LOGIN}}++;

$inventory->addEntry(
Expand Down
17 changes: 15 additions & 2 deletions lib/FusionInventory/Agent/Tools/Win32.pm
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use Win32::TieRegistry (
qw/KEY_READ/
);

use utf8;
use File::Temp ();
use File::Temp qw(:seekable);
use Win32::Job;
Expand Down Expand Up @@ -66,7 +67,9 @@ sub encodeFromRegistry {
## no critic (ExplicitReturnUndef)
return undef unless $string;

return encode("UTF-8", decode(getLocalCodepage(), $string));
return $string if Encode::is_utf8($string);

return decode(getLocalCodepage(), $string);
}

sub getWmiObjects {
Expand All @@ -84,7 +87,17 @@ sub getWmiObjects {
)) {
my $object;
foreach my $property (@{$params{properties}}) {
$object->{$property} = $instance->{$property};
if (!ref($instance->{$property}) && $instance->{$property}) {
# cast the Win32::OLE object in string
$object->{$property} = sprintf("%s", $instance->{$property});

# because of the Win32::OLE->Option(CP => Win32::OLE::CP_UTF8);
# we know it's UTF8, let's flag the string according because
# Win32::OLE don't do it
utf8::upgrade($object->{$property});
} else {
$object->{$property} = $instance->{$property};
}
}
push @objects, $object;
}
Expand Down
1 change: 1 addition & 0 deletions lib/FusionInventory/Agent/XML/Query.pm
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ sub getContent {
my ($self) = @_;

my $tpp = XML::TreePP->new(indent => 2);

return $tpp->write({ REQUEST => $self->{h} });
}

Expand Down

0 comments on commit c07208b

Please sign in to comment.