Subject: | Problem in using Japanese String |
Date: | Tue, 6 May 2008 11:33:20 +0900 |
To: | <bug-VUser-Google-Apps [...] rt.cpan.org> |
From: | "Kaoru Sekiguchi" <sekiguchi.kaoru [...] secioss.co.jp> |
I set Japanese string in user name.
The bellow error occured when I try to get user data by calling
RetrieveAllUsers().
Cannot decode string with wide characters at
/usr/lib/perl5/5.8.8/i386-linux-thread-multi/ Encode.pm line 186, <DATA>
line 597.
I think it's because the decoded Japanese string was decoded again.
I solved this error by the bellow patch.
diff -cNr
VUser-Google-Apps-0.1.0.org/lib/VUser/Google/ProvisioningAPI/V2_0.pm
VUser-Google-Apps-0.1.0/lib/VUser/Google/Provi
sioningAPI/V2_0.pm
*** VUser-Google-Apps-0.1.0.org/lib/VUser/Google/ProvisioningAPI/V2_0.pm
2007-09-18 00:47:48.000000000 +0900
--- VUser-Google-Apps-0.1.0/lib/VUser/Google/ProvisioningAPI/V2_0.pm
2008-05-06 10:58:43.000000000 +0900
***************
*** 401,407 ****
#this avoids the need to use XML::NameSpace
# v2.0 uses a couple namespaces now, instead of just one.
# I'm not sure that we can avoid using XML::NameSpace
! my $xml = decode('UTF-8', $response->content);
#$xml =~ s/hs\://g;
$self->dprint( $xml );
--- 401,413 ----
#this avoids the need to use XML::NameSpace
# v2.0 uses a couple namespaces now, instead of just one.
# I'm not sure that we can avoid using XML::NameSpace
! my $xml;
! my $content = $response->content;
! if (Encode::is_utf8($content)) {
! $xml = decode('UTF-8', $content);
! } else {
! $xml = $content;
! }
#$xml =~ s/hs\://g;
$self->dprint( $xml );
***************
*** 431,437 ****
# So, we need to check the content anyway to see if there is a
# reason for the failure.
$self->dprint("Google API failure!");
! my $xml = decode('UTF-8', $response->content);
$self->dprint( $xml );
if ($xml) {
my $simple = XML::Simple->new(ForceArray => 1);
--- 437,449 ----
# So, we need to check the content anyway to see if there is a
# reason for the failure.
$self->dprint("Google API failure!");
! my $xml;
! my $content = $response->content;
! if (Encode::is_utf8($content)) {
! $xml = decode('UTF-8', $content);
! } else {
! $xml = $content;
! }
$self->dprint( $xml );
if ($xml) {
my $simple = XML::Simple->new(ForceArray => 1);
-------------------------
Kaoru Sekiguchi
E-Mail: sekiguchi.kaoru@secioss.co.jp
URL: http://www.secioss.co.jp