From: gggeek Date: Wed, 18 Jan 2023 07:55:15 +0000 (+0000) Subject: use charset preferred by client if possible X-Git-Tag: 4.10.0~137 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=49313fec31020b8a8e3aae2e909ca7f5f22f56e3;p=plcapi.git use charset preferred by client if possible --- diff --git a/src/Server.php b/src/Server.php index 51b6f01f..c23661cf 100644 --- a/src/Server.php +++ b/src/Server.php @@ -547,15 +547,14 @@ class Server arsort($clientAcceptedCharsets); $clientAcceptedCharsets = array_keys($clientAcceptedCharsets); - // Give preference to internal encoding - $knownCharsets = array(PhpXmlRpc::$xmlrpc_internalencoding, 'UTF-8', 'ISO-8859-1', 'US-ASCII'); + $knownCharsets = array('UTF-8', 'ISO-8859-1', 'US-ASCII'); // if mbstring is enabled, we can support other charsets too! /// @todo add a method to the Charset helper to retrieve this list (and remove from it junk entries) if (function_exists('mb_list_encodings')) { $knownCharsets = array_unique(array_merge($knownCharsets, mb_list_encodings())); } - foreach ($knownCharsets as $charset) { - foreach ($clientAcceptedCharsets as $accepted) { + foreach ($clientAcceptedCharsets as $accepted) { + foreach ($knownCharsets as $charset) { if ($accepted == strtoupper($charset)) { $respEncoding = $charset; break 2;