git://git.onelab.eu
/
plcapi.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
3b18a71
)
allow flexible charset decoding for polyfill-xmlrpc
author
gggeek
<giunta.gaetano@gmail.com>
Sat, 9 Jan 2021 18:34:31 +0000
(18:34 +0000)
committer
gggeek
<giunta.gaetano@gmail.com>
Sat, 9 Jan 2021 18:34:31 +0000
(18:34 +0000)
NEWS
patch
|
blob
|
history
src/Encoder.php
patch
|
blob
|
history
diff --git
a/NEWS
b/NEWS
index
f3caf81
..
0ff0d6d
100644
(file)
--- a/
NEWS
+++ b/
NEWS
@@
-1,4
+1,4
@@
-XML-RPC for PHP version 4.5.2 -
unreleased
+XML-RPC for PHP version 4.5.2 -
2021/1/9
* improved: better phpdocs in the the php code generated by the Wrapper class
* improved: better phpdocs in the the php code generated by the Wrapper class
@@
-6,6
+6,8
@@
XML-RPC for PHP version 4.5.2 - unreleased
* improved: debugger favicon and page title when used from the phpjsonrpc library
* improved: debugger favicon and page title when used from the phpjsonrpc library
+* fixed: allow `Encoder::decode` to properly support different target character sets for polyfill-xmlrpc decode functions
+
XML-RPC for PHP version 4.5.1 - 2021/1/3
XML-RPC for PHP version 4.5.1 - 2021/1/3
diff --git
a/src/Encoder.php
b/src/Encoder.php
index
d352831
..
ecb64bd
100644
(file)
--- a/
src/Encoder.php
+++ b/
src/Encoder.php
@@
-54,8
+54,17
@@
class Encoder
'scalar' => $val
);
return (object)$xmlrpcVal;
'scalar' => $val
);
return (object)$xmlrpcVal;
+ case 'string':
+ if (isset($options['extension_api_encoding'])) {
+ $dval = @iconv('UTF-8', $options['extension_api_encoding'], $val);
+ if ($dval !== false) {
+ return $dval;
+ }
+ }
+ //return $val;
+ // break through voluntarily
default:
default:
- return $
xmlrpcVal->scalarval()
;
+ return $
val
;
}
}
if (in_array('dates_as_objects', $options) && $xmlrpcVal->scalartyp() == 'dateTime.iso8601') {
}
}
if (in_array('dates_as_objects', $options) && $xmlrpcVal->scalartyp() == 'dateTime.iso8601') {
@@
-279,6
+288,7
@@
class Encoder
// What if internal encoding is not in one of the 3 allowed? We use the broadest one, ie. utf8!
if (!in_array(PhpXmlRpc::$xmlrpc_internalencoding, array('UTF-8', 'ISO-8859-1', 'US-ASCII'))) {
// What if internal encoding is not in one of the 3 allowed? We use the broadest one, ie. utf8!
if (!in_array(PhpXmlRpc::$xmlrpc_internalencoding, array('UTF-8', 'ISO-8859-1', 'US-ASCII'))) {
+ /// @todo emit a warning
$parserOptions = array(XML_OPTION_TARGET_ENCODING => 'UTF-8');
} else {
$parserOptions = array(XML_OPTION_TARGET_ENCODING => PhpXmlRpc::$xmlrpc_internalencoding);
$parserOptions = array(XML_OPTION_TARGET_ENCODING => 'UTF-8');
} else {
$parserOptions = array(XML_OPTION_TARGET_ENCODING => PhpXmlRpc::$xmlrpc_internalencoding);