Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect character encoding when set custom attribute with special characters using the SOAP API #1407

Closed
Bakaras opened this issue May 30, 2022 · 28 comments · Fixed by #1413
Labels
Milestone

Comments

@Bakaras
Copy link

Bakaras commented May 30, 2022

Version

6.2.60

[Note by admin: Patch by PR #1402 has to be applied]

Installation method

deb

Expected behavior

Custom attributes are set with correct characters.

Actual behavior

Custom attributes are set with incorrect characters.
Here with german umlauts: first name Jürgen.

Steps to reproduce

  1. Set a custom attribute:
# sympa_soap_client.pl --trusted_application=trustedapp --trusted_application_password=tapasswd
--soap_url=https://listen.dom.ain/sympasoap --service=setCustom [email protected]
--service_parameters=testlist1,vorname,Jürgen
calling authenticateRemoteAppAndRun( trustedapp, tapasswd, [email protected],setCustom,testlist1,vorname,Jürgen)
0
	'1'
  1. Get subscriber details:
# sympa_soap_client.pl --trusted_application=trustedapp --trusted_application_password=tapasswd
--soap_url=https://listen.dom.ain/sympasoap --service=getDetails [email protected]
--service_parameters=testlist1
calling authenticateRemoteAppAndRun( trustedapp, tapasswd, [email protected],getDetails,testlist1)
0
	_custom_
		0
			_key_
				'vorname'
			_value_
				'Jürgen'
		1
			_key_
				'anrede'
			_value_
				'Herr'
		2
			_key_
				'nachname'
			_value_
				'Schmidt'
	_gecos_
		'Brunnenbau Münster'
	_reception_
		'mail'
	_subscribeDate_
		'1653904994'
	_updateDate_
		'1653904994'

On web interface:
ca1

Additional information

# locale
LANG=de_DE.UTF-8
LANGUAGE=de_DE.UTF-8
LC_CTYPE="de_DE.UTF-8"
LC_NUMERIC="de_DE.UTF-8"
LC_TIME="de_DE.UTF-8"
LC_COLLATE="de_DE.UTF-8"
LC_MONETARY="de_DE.UTF-8"
LC_MESSAGES="de_DE.UTF-8"
LC_PAPER="de_DE.UTF-8"
LC_NAME="de_DE.UTF-8"
LC_ADDRESS="de_DE.UTF-8"
LC_TELEPHONE="de_DE.UTF-8"
LC_MEASUREMENT="de_DE.UTF-8"
LC_IDENTIFICATION="de_DE.UTF-8"
LC_ALL=de_DE.UTF-8
@Bakaras
Copy link
Author

Bakaras commented May 30, 2022

Changing the SOAP.pm file fixes the error for me:

--- SOAP.pm.orig	2022-05-30 11:58:07.784000000 +0200
+++ SOAP.pm.ok	2022-05-21 22:08:44.008000000 +0200
@@ -1498,6 +1498,10 @@
             ->faultdetail('Use : <list> <key> <value> ');
     }
     %newcustom = %{$subscriber->{custom_attribute} // {}};
+        foreach my $customkey (keys %newcustom) {
+            my $customvalue = $newcustom{$customkey}{value};
+            $newcustom{$customkey}{value} = Encode::decode_utf8($customvalue);
+        }
     #if(! defined $list->{'admin'}{'custom_attribute'}{$key} ) {
     #	return SOAP::Data->name('result')->type('boolean')->value(0);
     #}
@@ -1507,7 +1511,7 @@
         # $newcustom{$key} = $list->{'admin'}{'custom_attribute'}{$key}
         #     if !defined $newcustom{$key}
         #         and defined $list->{'admin'}{'custom_attribute'};
-        $newcustom{$key}{value} = $value;
+        $newcustom{$key}{value} = Encode::decode_utf8($value);
     }
     die SOAP::Fault->faultcode('Server')
         ->faultstring('Unable to set user attributes')

Custom attribute are set with correct characters:

# sympa_soap_client.pl --trusted_application=trustedapp --trusted_application_password=tapasswd
--soap_url=https://listen.dom.ain/sympasoap --service=setCustom [email protected]
--service_parameters=testlist1,vorname,Jürgen
calling authenticateRemoteAppAndRun( trustedapp, tapasswd, [email protected],setCustom,testlist1,vorname,Jürgen)
0
	'1'

getDetails: correct characters

# sympa_soap_client.pl --trusted_application=trustedapp --trusted_application_password=tapasswd
--soap_url=https://listen.dom.ain/sympasoap --service=getDetails [email protected]
--service_parameters=testlist1
calling authenticateRemoteAppAndRun( trustedapp, tapasswd, [email protected],getDetails,testlist1)
0
	_custom_
		0
			_key_
				'anrede'
			_value_
				'Herr'
		1
			_key_
				'vorname'
			_value_
				'Jürgen'
		2
			_key_
				'nachname'
			_value_
				'Schmidt'
	_gecos_
		'Brunnenbau Münster'
	_reception_
		'mail'
	_subscribeDate_
		'1653904994'
	_updateDate_
		'1653904994'

And correct characters on web interface:
ca2

@ikedas ikedas added the bug label May 30, 2022
@ikedas
Copy link
Member

ikedas commented May 31, 2022

Hi @Bakaras ,

Just for information, is this problem specific to sympa_soap_client.pl? Or does it also occur in real SOAP applications?

@racke
Copy link
Contributor

racke commented May 31, 2022

SOAP::Lite's UTF8 support seems to be buggy: https://rt.cpan.org/Public/Bug/Display.html?id=86649

@ikedas
Copy link
Member

ikedas commented May 31, 2022

@racke, I suspect that is a different issue. sympa_soap_client.pl looks not passing arguments to SOAP::Lite as utf8 string. I guess the real applications do so correctly.

@racke
Copy link
Contributor

racke commented May 31, 2022

@ikedas, that is also possible.

@ikedas
Copy link
Member

ikedas commented May 31, 2022

@Bakaras , additional question: Can you try with following patch (without your patch above)?

diff --git a/src/bin/sympa_soap_client.pl.in b/src/bin/sympa_soap_client.pl.in
index 8e97c4d..4a9134a 100644
--- a/src/bin/sympa_soap_client.pl.in
+++ b/src/bin/sympa_soap_client.pl.in
@@ -26,6 +26,7 @@
 use lib '--modulesdir--';
 use strict;
 use warnings;
+use Encode qw();
 use Getopt::Long;
 use HTTP::Cookies;
 #use SOAP::Lite +trace;
@@ -170,6 +171,10 @@ sub play_soap_as_trusted {
     printf
         "calling authenticateRemoteAppAndRun( $trusted_application, $trusted_application_password, $proxy_vars,$service,$p)\n";

+    foreach my $param (@parameters) {
+        $param = Encode::decode_utf8($param);
+    }
+
     my $reponse =
         $soap->authenticateRemoteAppAndRun($trusted_application,
         $trusted_application_password, $proxy_vars, $service, \@parameters);
@@ -264,6 +269,10 @@ sub play_soap {
         @parameters = split /,/, $service_parameters;
     }

+    foreach my $param (@parameters) {
+        $param = Encode::decode_utf8($param);
+    }
+
     if ($service eq 'lists') {
         printf "\n\nlists....\n";
         $reponse = $soap->lists();

@Bakaras
Copy link
Author

Bakaras commented May 31, 2022

Hi @Bakaras ,

Just for information, is this problem specific to sympa_soap_client.pl? Or does it also occur in real SOAP applications?

I have no real SOAP application.
I use sympa_soap_client.pl in shell script to import subscribers.
In addition:
To make the call getDetails working i have changed sympa_soap_client.pl:

         if (ref($r->result) =~ /^ARRAY/) {
             #printf "R: $r->result\n";
             @ret = @{$r->result};
+        }elsif (ref( $r->result) =~ /^HASH/) {
+            @ret = ( $r->result );
         } elsif (ref $r->result) {
             print "Pb " . ($r->result) . "\n";
             return undef;

Without this change I have this output:

calling authenticateRemoteAppAndRun( trustedapp, tapasswd, [email protected],getDetails,testlist1)
Pb HASH(0x55eff8ca7380)

@Bakaras Bakaras closed this as completed May 31, 2022
@Bakaras Bakaras closed this as not planned Won't fix, can't repro, duplicate, stale May 31, 2022
@Bakaras Bakaras reopened this May 31, 2022
@Bakaras
Copy link
Author

Bakaras commented May 31, 2022

@Bakaras , additional question: Can you try with following patch (without your patch above)?

diff --git a/src/bin/sympa_soap_client.pl.in b/src/bin/sympa_soap_client.pl.in
index 8e97c4d..4a9134a 100644
--- a/src/bin/sympa_soap_client.pl.in
+++ b/src/bin/sympa_soap_client.pl.in
@@ -26,6 +26,7 @@
 use lib '--modulesdir--';
 use strict;
 use warnings;
+use Encode qw();
 use Getopt::Long;
 use HTTP::Cookies;
 #use SOAP::Lite +trace;
@@ -170,6 +171,10 @@ sub play_soap_as_trusted {
     printf
         "calling authenticateRemoteAppAndRun( $trusted_application, $trusted_application_password, $proxy_vars,$service,$p)\n";

+    foreach my $param (@parameters) {
+        $param = Encode::decode_utf8($param);
+    }
+
     my $reponse =
         $soap->authenticateRemoteAppAndRun($trusted_application,
         $trusted_application_password, $proxy_vars, $service, \@parameters);
@@ -264,6 +269,10 @@ sub play_soap {
         @parameters = split /,/, $service_parameters;
     }

+    foreach my $param (@parameters) {
+        $param = Encode::decode_utf8($param);
+    }
+
     if ($service eq 'lists') {
         printf "\n\nlists....\n";
         $reponse = $soap->lists();

It did not help

@racke
Copy link
Contributor

racke commented May 31, 2022

Hi @Bakaras ,
Just for information, is this problem specific to sympa_soap_client.pl? Or does it also occur in real SOAP applications?

I have no real SOAP application. I use sympa_soap_client.pl in shell script to import subscribers. In addition: To make the call getDetails working i have changed sympa_soap_client.pl:

That doesn't make sense to me. Why don't you use the Sympa CLI?

         if (ref($r->result) =~ /^ARRAY/) {
             #printf "R: $r->result\n";
             @ret = @{$r->result};
+        }elsif (ref( $r->result) =~ /^HASH/) {
+            @ret = ( $r->result );
         } elsif (ref $r->result) {
             print "Pb " . ($r->result) . "\n";
             return undef;

Without this change I have this output:

calling authenticateRemoteAppAndRun( trustedapp, tapasswd, [email protected],getDetails,testlist1)
Pb HASH(0x55eff8ca7380)

@Bakaras
Copy link
Author

Bakaras commented May 31, 2022

I think with Sympa CLI custom attributes are not imported (?)

@ikedas
Copy link
Member

ikedas commented May 31, 2022

@Bakaras , additional question: Can you try with following patch (without your patch above)?

diff --git a/src/bin/sympa_soap_client.pl.in b/src/bin/sympa_soap_client.pl.in
index 8e97c4d..4a9134a 100644
--- a/src/bin/sympa_soap_client.pl.in
+++ b/src/bin/sympa_soap_client.pl.in
@@ -26,6 +26,7 @@
 use lib '--modulesdir--';
 use strict;
 use warnings;
+use Encode qw();
 use Getopt::Long;
 use HTTP::Cookies;
 #use SOAP::Lite +trace;
@@ -170,6 +171,10 @@ sub play_soap_as_trusted {
     printf
         "calling authenticateRemoteAppAndRun( $trusted_application, $trusted_application_password, $proxy_vars,$service,$p)\n";

+    foreach my $param (@parameters) {
+        $param = Encode::decode_utf8($param);
+    }
+
     my $reponse =
         $soap->authenticateRemoteAppAndRun($trusted_application,
         $trusted_application_password, $proxy_vars, $service, \@parameters);
@@ -264,6 +269,10 @@ sub play_soap {
         @parameters = split /,/, $service_parameters;
     }

+    foreach my $param (@parameters) {
+        $param = Encode::decode_utf8($param);
+    }
+
     if ($service eq 'lists') {
         printf "\n\nlists....\n";
         $reponse = $soap->lists();

It did not help

Is the result exactly the same as before applying the patch? Could you please show the actual result?

@Bakaras
Copy link
Author

Bakaras commented May 31, 2022

Yes, the result is exactly the same.

@Bakaras
Copy link
Author

Bakaras commented May 31, 2022

In addition:
If a custom attribute with Umlaut defined first, after that defined or modified others,
the value becomes longer.

			_key_
				'vorname'
			_value_
				'Jürgen'
			_key_
				'vorname'
			_value_
				'Jürgen'
			_key_
				'vorname'
			_value_
				'JÃÂürgen'
			_key_
				'vorname'
			_value_
				'JÃÂÃÂÃÂürgen'
			_key_
				'vorname'
			_value_
				'JÃÂÃÂÃÂÃÂÃÂÃÂÃÂürgen'

@racke
Copy link
Contributor

racke commented May 31, 2022

I think with Sympa CLI custom attributes are not imported (?)

Oops, yes that is quite possible 😇

@ikedas
Copy link
Member

ikedas commented May 31, 2022

In addition: If a custom attribute with Umlaut defined first, after that defined or modified others, the value becomes longer.

Interesting. How to reproduce it? Can you show the steps?

BTW in your first example in above, umlaut is transformed to two characters but not three characters in your previous result. Is this difference caused by my patch? If it is, I might catch the tail of bug...

@Bakaras
Copy link
Author

Bakaras commented May 31, 2022

# cat history-cmd.sh 
sympa_soap_client.pl --trusted_application=soaplistengkdre --trusted_application_password=Uazee5no --soap_url=https://listen.gkd.re/sympasoap --service=setCustom [email protected] --service_parameters=testliste1,vorname,Jürgen
sympa_soap_client.pl --trusted_application=soaplistengkdre --trusted_application_password=Uazee5no --soap_url=https://listen.gkd.re/sympasoap --service=getDetails [email protected] --service_parameters=testliste1
sympa_soap_client.pl --trusted_application=soaplistengkdre --trusted_application_password=Uazee5no --soap_url=https://listen.gkd.re/sympasoap --service=setCustom [email protected] --service_parameters=testliste1,nachname,Schmidt
sympa_soap_client.pl --trusted_application=soaplistengkdre --trusted_application_password=Uazee5no --soap_url=https://listen.gkd.re/sympasoap --service=getDetails [email protected] --service_parameters=testliste1
sympa_soap_client.pl --trusted_application=soaplistengkdre --trusted_application_password=Uazee5no --soap_url=https://listen.gkd.re/sympasoap --service=setCustom [email protected] --service_parameters=testliste1,anrede,Herr
sympa_soap_client.pl --trusted_application=soaplistengkdre --trusted_application_password=Uazee5no --soap_url=https://listen.gkd.re/sympasoap --service=getDetails [email protected] --service_parameters=testliste1
sympa_soap_client.pl --trusted_application=soaplistengkdre --trusted_application_password=Uazee5no --soap_url=https://listen.gkd.re/sympasoap --service=setCustom [email protected] --service_parameters=testliste1,titel,Dr
sympa_soap_client.pl --trusted_application=soaplistengkdre --trusted_application_password=Uazee5no --soap_url=https://listen.gkd.re/sympasoap --service=getDetails [email protected] --service_parameters=testliste1
sympa_soap_client.pl --trusted_application=soaplistengkdre --trusted_application_password=Uazee5no --soap_url=https://listen.gkd.re/sympasoap --service=setCustom [email protected] --service_parameters=testliste1,titel,Dr
sympa_soap_client.pl --trusted_application=soaplistengkdre --trusted_application_password=Uazee5no --soap_url=https://listen.gkd.re/sympasoap --service=getDetails [email protected] --service_parameters=testliste1

Output:

root@gkd-i222(sympa):~# sh history-cmd.sh 
calling authenticateRemoteAppAndRun( soaplistengkdre, Uazee5no, [email protected],setCustom,testliste1,vorname,Jürgen)
0
	'1'
calling authenticateRemoteAppAndRun( soaplistengkdre, Uazee5no, [email protected],getDetails,testliste1)
0
	_custom_
		0
			_key_
				'vorname'
			_value_
				'Jürgen'
		1
			_key_
				'anrede'
			_value_
				'Herr'
		2
			_key_
				'nachname'
			_value_
				'Schmidt'
		3
			_key_
				'titel'
			_value_
				'Dr'
	_gecos_
		'Brunnenbau Matejka'
	_reception_
		'mail'
	_subscribeDate_
		'1653923379'
	_updateDate_
		'1653923379'


calling authenticateRemoteAppAndRun( soaplistengkdre, Uazee5no, [email protected],setCustom,testliste1,nachname,Schmidt)
0
	'1'
calling authenticateRemoteAppAndRun( soaplistengkdre, Uazee5no, [email protected],getDetails,testliste1)
0
	_custom_
		0
			_key_
				'vorname'
			_value_
				'Jürgen'
		1
			_key_
				'titel'
			_value_
				'Dr'
		2
			_key_
				'anrede'
			_value_
				'Herr'
		3
			_key_
				'nachname'
			_value_
				'Schmidt'
	_gecos_
		'Brunnenbau Matejka'
	_reception_
		'mail'
	_subscribeDate_
		'1653923379'
	_updateDate_
		'1653923379'
calling authenticateRemoteAppAndRun( soaplistengkdre, Uazee5no,
[email protected],setCustom,testliste1,anrede,Herr)
0
	'1'
calling authenticateRemoteAppAndRun( soaplistengkdre, Uazee5no,
[email protected],getDetails,testliste1)
0
	_custom_
		0
			_key_
				'vorname'
			_value_
				'JÃÂürgen'
		1
			_key_
				'nachname'
			_value_
				'Schmidt'
		2
			_key_
				'anrede'
			_value_
				'Herr'
		3
			_key_
				'titel'
			_value_
				'Dr'
	_gecos_
		'Brunnenbau Matejka'
	_reception_
		'mail'
	_subscribeDate_
		'1653923379'
	_updateDate_
		'1653923379'


calling authenticateRemoteAppAndRun( soaplistengkdre, Uazee5no,
[email protected],setCustom,testliste1,titel,Dr)
0
	'1'
calling authenticateRemoteAppAndRun( soaplistengkdre, Uazee5no,
[email protected],getDetails,testliste1)
0
	_custom_
		0
			_key_
				'vorname'
			_value_
				'JÃÂÃÂÃÂürgen'
		1
			_key_
				'nachname'
			_value_
				'Schmidt'
		2
			_key_
				'anrede'
			_value_
				'Herr'
		3
			_key_
				'titel'
			_value_
				'Dr'
	_gecos_
		'Brunnenbau Matejka'
	_reception_
		'mail'
	_subscribeDate_
		'1653923379'
	_updateDate_
		'1653923379'


calling authenticateRemoteAppAndRun( soaplistengkdre, Uazee5no,
[email protected],setCustom,testliste1,titel,Dr)
0
	'1'
calling authenticateRemoteAppAndRun( soaplistengkdre, Uazee5no,
[email protected],getDetails,testliste1)
0
	_custom_
		0
			_key_
				'titel'
			_value_
				'Dr'
		1
			_key_
				'anrede'
			_value_
				'Herr'
		2
			_key_
				'nachname'
			_value_
				'Schmidt'
		3
			_key_
				'vorname'
			_value_
				'JÃÂÃÂÃÂÃÂÃÂÃÂÃÂürgen'
	_gecos_
		'Brunnenbau Matejka'
	_reception_
		'mail'
	_subscribeDate_
		'1653923379'
	_updateDate_
		'1653923379'

Sorry, have now eaten and drank some beer, left the real data as it is.
Is not important now.

@Bakaras
Copy link
Author

Bakaras commented May 31, 2022

BTW in your first example in above, umlaut is transformed to two characters but not three characters in your previous result. Is this difference caused by my patch? If it is, I might catch the tail of bug...

It was probably the output after the second call.
It was yesterday. Very far in the past.

@ikedas
Copy link
Member

ikedas commented Jun 1, 2022

@Bakaras , sorry to interrupt your relaxation time:smile:. At the moment the fix you suggested looks promising, and I will prepare a PR based on it.

@ikedas
Copy link
Member

ikedas commented Jun 1, 2022

@Bakaras , I found this workaround solves the problem.

diff --git a/src/lib/Sympa/WWW/SOAP.pm b/src/lib/Sympa/WWW/SOAP.pm
index ba4caf9..6fc986b 100644
--- a/src/lib/Sympa/WWW/SOAP.pm
+++ b/src/lib/Sympa/WWW/SOAP.pm
@@ -1501,6 +1501,11 @@ sub setCustom {
     #if(! defined $list->{'admin'}{'custom_attribute'}{$key} ) {
     #  return SOAP::Data->name('result')->type('boolean')->value(0);
     #}
+
+    $log->syslog('info', 'key=%s:utf8=%s; value=%s:utf8=%s',
+        $key, Encode::is_utf8($key), $value, Encode::is_utf8($value));
+    $key = Encode::encode_utf8($key) if Encode::is_utf8($key);
+
     if ($value eq '') {
         undef $newcustom{$key};
     } else {

The log line added by this is

info Sympa::WWW::SOAP::setCustom() key=vorname:utf8=1; value=Jürgen:utf8=

This behavior seems due to bug (or buggy behavior) of SOAP::Lite.

@Bakaras
Copy link
Author

Bakaras commented Jun 1, 2022

OK, with workaround, custom attribute "vorname" are set with correct characters.

# sympa_soap_client.pl --trusted_application=soaplistengkdre --trusted_application_password=Uazee5no
--soap_url=https://listen.gkd.re/sympasoap --service=setCustom
 [email protected]
 --service_parameters=testliste1,vorname,Jürgen
calling authenticateRemoteAppAndRun( soaplistengkdre, Uazee5no, [email protected],setCustom,testliste1,vorname,Jürgen)
0
	'1'
# sympa_soap_client.pl --trusted_application=soaplistengkdre --trusted_application_password=Uazee5no
--soap_url=https://listen.gkd.re/sympasoap --service=getDetails
[email protected] --service_parameters=testliste1
calling authenticateRemoteAppAndRun( soaplistengkdre, Uazee5no, [email protected],getDetails,testliste1)
0
	_custom_
		0
			_key_
				'vorname'
			_value_
				'Jürgen'
	_gecos_
		'Jürgen Schmidt'
	_reception_
		'mail'
	_subscribeDate_
		'1654087972'
	_updateDate_
		'1654087972'

But after setCustom "nachname" is "vorname" broken again:

# sympa_soap_client.pl --trusted_application=soaplistengkdre --trusted_application_password=Uazee5no --soap_url=https://listen.gkd.re/sympasoap --service=setCustom [email protected] --service_parameters=testliste1,nachname,Schmidt
calling authenticateRemoteAppAndRun( soaplistengkdre, Uazee5no, [email protected],setCustom,testliste1,nachname,Schmidt)
0
	'1'
# sympa_soap_client.pl --trusted_application=soaplistengkdre --trusted_application_password=Uazee5no --soap_url=https://listen.gkd.re/sympasoap --service=getDetails [email protected] --service_parameters=testliste1
calling authenticateRemoteAppAndRun( soaplistengkdre, Uazee5no, [email protected],getDetails,testliste1)
0
	_custom_
		0
			_key_
				'vorname'
			_value_
				'Jürgen'
		1
			_key_
				'nachname'
			_value_
				'Schmidt'
	_gecos_
		'Jürgen Schmidt'
	_reception_
		'mail'
	_subscribeDate_
		'1654087972'
	_updateDate_
		'1654087972'

@Bakaras
Copy link
Author

Bakaras commented Jun 1, 2022

In addition:
Gecos are set by setDetails with correct characters, and is not broken later.

sympa_soap_client.pl --trusted_application=soaplistengkdre --trusted_application_password=Uazee5no
--soap_url=https://listen.gkd.re/sympasoap --service=setDetails
[email protected]
--service_parameters=testliste1,Jürgen\ Schmidt

@ikedas
Copy link
Member

ikedas commented Jun 5, 2022

@Bakaras , what is shown in the log?

@Bakaras
Copy link
Author

Bakaras commented Jun 6, 2022

@Bakaras , what is shown in the log?

Jun  1 14:42:44 i2 sympasoap[13033]: notice Sympa::WWW::SOAP::authenticateRemoteAppAndRun(soaplistengkdre, [email protected], setCustom, testliste1,vorname,Jürgen)
Jun  1 14:42:44 i2 sympasoap[13033]: info Sympa::WWW::SOAP::setCustom() key=vorname:utf8=1; value=Jürgen:utf8=
Jun  1 14:42:58 i2 sympasoap[13033]: notice Sympa::WWW::SOAP::authenticateRemoteAppAndRun(soaplistengkdre, [email protected], setCustom, testliste1,nachname,Schmidt)
Jun  1 14:42:58 i2 sympasoap[13033]: info Sympa::WWW::SOAP::setCustom() key=nachname:utf8=1; value=Schmidt:utf8=1

@ikedas
Copy link
Member

ikedas commented Jun 7, 2022

Thanks @Bakaras !

info Sympa::WWW::SOAP::setCustom() key=vorname:utf8=1; value=Jürgen:utf8=
info Sympa::WWW::SOAP::setCustom() key=nachname:utf8=1; value=Schmidt:utf8=1

It is probably a bug in SOAP::Lite (but probably different from the one @racke referred to).

What is the version of SOAP::Lite you use? I use 1.10.

Anyways workaround would be as below:

diff --git a/src/lib/Sympa/WWW/SOAP.pm b/src/lib/Sympa/WWW/SOAP.pm
index ba4caf9..6fc986b 100644
--- a/src/lib/Sympa/WWW/SOAP.pm
+++ b/src/lib/Sympa/WWW/SOAP.pm
@@ -1501,6 +1501,10 @@ sub setCustom {
     #if(! defined $list->{'admin'}{'custom_attribute'}{$key} ) {
     #  return SOAP::Data->name('result')->type('boolean')->value(0);
     #}
+
+    Encode::_utf8_off($key);
+    Encode::_utf8_off($value);
+
     if ($value eq '') {
         undef $newcustom{$key};
     } else {

@Bakaras
Copy link
Author

Bakaras commented Jun 8, 2022

Thanks @Bakaras !

info Sympa::WWW::SOAP::setCustom() key=vorname:utf8=1; value=Jürgen:utf8=
info Sympa::WWW::SOAP::setCustom() key=nachname:utf8=1; value=Schmidt:utf8=1

It is probably a bug in SOAP::Lite (but probably different from the one @racke referred to).

What is the version of SOAP::Lite you use? I use 1.10.

# dpkg -l | grep -i soap
ii  libsoap-lite-perl                   1.27-1                             all          Perl implementation of a SOAP client and server

@racke racke added this to the 6.2.70 milestone Jun 8, 2022
@ikedas
Copy link
Member

ikedas commented Jun 9, 2022

@Bakaras , if you have no objection, I'll merge the PR above, and it will be included in the next release.

@Bakaras
Copy link
Author

Bakaras commented Jun 9, 2022

OK, Jürgen is happy.

sympa_soap_client.pl --trusted_application=soaplistengkdre --trusted_application_password=Uazee5no --soap_url=https://listen.gkd.re/sympasoap --service=getDetails [email protected] --service_parameters=testliste1
calling authenticateRemoteAppAndRun( soaplistengkdre, Uazee5no, [email protected],getDetails,testliste1)
0
	_custom_
		0
			_key_
				'vorname'
			_value_
				'Jürgen'
		1
			_key_
				'nachname'
			_value_
				'Schmidt'
		2
			_key_
				'anrede'
			_value_
				'Herr'
	_gecos_
		'Jürgen Schmidt'
	_reception_
		'mail'
	_subscribeDate_
		'1654761809'
	_updateDate_
		'1654761809'

And what about sympa_soap_client.pl?

         if (ref($r->result) =~ /^ARRAY/) {
             #printf "R: $r->result\n";
             @ret = @{$r->result};
+        }elsif (ref( $r->result) =~ /^HASH/) {
+            @ret = ( $r->result );
         } elsif (ref $r->result) {
             print "Pb " . ($r->result) . "\n";
             return undef;

@ikedas
Copy link
Member

ikedas commented Jun 9, 2022

OK, Jürgen is happy.

Thanks!

And what about sympa_soap_client.pl?

         if (ref($r->result) =~ /^ARRAY/) {
             #printf "R: $r->result\n";
             @ret = @{$r->result};
+        }elsif (ref( $r->result) =~ /^HASH/) {
+            @ret = ( $r->result );
         } elsif (ref $r->result) {
             print "Pb " . ($r->result) . "\n";
             return undef;

I'd overlooked it. Thanks for the reminder!

ikedas added a commit that referenced this issue Jun 12, 2022
SympaSOAP: Result by setCustom with parameter including non-ASCII characters is broken (#1407)
ikedas added a commit to ikedas/sympa that referenced this issue Feb 11, 2023
ikedas added a commit to ikedas/sympa that referenced this issue Feb 11, 2023
ikedas added a commit to ikedas/sympa that referenced this issue Feb 12, 2023
ikedas added a commit to ikedas/sympa that referenced this issue Jun 24, 2023
ikedas added a commit to ikedas/sympa that referenced this issue Jun 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants