php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #73908 Invalid UTF-8 encoding
Submitted: 2017-01-10 14:54 UTC Modified: 2017-02-11 20:12 UTC
From: bugsphpnet at atis dot id dot lv Assigned:
Status: Not a bug Package: XMLRPC-EPI related
PHP Version: 7.1.0 OS: Ubuntu 16.04
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
3 + 17 = ?
Subscribe to this entry?

 
 [2017-01-10 14:54 UTC] bugsphpnet at atis dot id dot lv
Description:
------------
---
From manual page: http://www.php.net/function.xmlrpc-encode
---
UTF-8 characters are incorrectly encoded. 208 character code turns into 28, and 209 turns into 29, etc

PHP 5.3.10 did not had this problem.

Problem has been reproduced on versions:

 PHP 7.1.0-5+deb.sury.org~xenial+1 (cli) ( NTS )
 PHP 7.0.8-0ubuntu0.16.04.3 (cli) ( NTS )


Test script:
---------------
<?php

print_r(xmlrpc_encode('Москва'));

Expected result:
----------------
<?xml version="1.0" encoding="utf-8"?><params><param><value><string>&#208;&#156;&#208;&#190;&#209;&#129;&#208;&#186;&#208;&#178;&#208;&#176;</string></value></param></params>

Actual result:
--------------
<?xml version="1.0" encoding="utf-8"?><params><param><value>  <string>&#28;&#156;&#28;&#190;&#29;&#129;&#28;&#186;&#28;&#178;&#28;&#176;</string></value></param></params>


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-01-10 14:56 UTC] bugsphpnet at atis dot id dot lv
For anyone stumbling upon this, a quick and ugly workaround:

/* Original call */
$response = xmlrpc_server_call_method($srv, $request, NULL, array('encoding'=>'UTF-8', 'verbosity'=>'no_white_space'));

$response = str_replace(array('&#28;','&#29;'),array('&#208;','&#209;'),$response);
 [2017-01-15 13:37 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2017-01-15 13:37 UTC] cmb@php.net
I'm not able to reproduce this with builds of the php.net
distribution, so this *might* be a downstream issue. Please check
whether it also works for you with such a build.
 [2017-01-17 15:21 UTC] bugsphpnet at atis dot id dot lv
Could not reproduce on vanilla php7, submitted downstream:

https://bugs.launchpad.net/ubuntu/+source/php7.0/+bug/1657158
 [2017-01-17 15:34 UTC] cmb@php.net
-Status: Feedback +Status: Not a bug
 [2017-01-17 15:34 UTC] cmb@php.net
Thanks!
 [2017-02-11 18:09 UTC] unhold1799 at gmail dot com
Currently I also have problems with the utf8 function.

Since the last update of php, utf8 encoded strings are no longer output correctly.

example:

Testaccount name "tdstuser1" outputs apcu and session t�stuser1 (t?stuser1)

String containing the umlaute included and before the update urgently had to be encoded, must now no longer be coded!
 [2017-02-11 18:22 UTC] cmb@php.net
-Status: Not a bug +Status: Feedback
 [2017-02-11 18:22 UTC] cmb@php.net
> Currently I also have problems with the utf8 function.

Which PHP version do you use?
 [2017-02-11 20:06 UTC] unhold1799 at gmail dot com
> Which PHP version do you use?

PHP Version 7.1.1-1+deb.sury.org~xenial+1


Test on utf8-html docs
_________________________________________

before Update

#apcu_delete('try');

$arrayx = array(
	"name" => utf8_decode("täst"),
	"position" => utf8_decode("Gärtner")
);

apcu_store('try', $arrayx, 3600);


print_r(apcu_fetch('try'));

the output was


Array
(
    [name] => täst
    [position] => Gärtner
)

after update the output was


Array
(
    [name] => t�st
    [position] => G�rtner
)

now i have to change all scripts

#apcu_delete('try');

$arrayx = array(
	"name" => "täst",
	"position" => "Gärtner"
);

apcu_store('try', $arrayx, 3600);


print_r(apcu_fetch('try'));

the output is

Array
(
    [name] => täst
    [position] => Gärtner
)

the problem, all sessions with umlauts are no longer output correctly, which also results in a === test error.
 [2017-02-11 20:12 UTC] cmb@php.net
-Status: Feedback +Status: Not a bug -Assigned To: cmb +Assigned To:
 [2017-02-11 20:12 UTC] cmb@php.net
> PHP Version 7.1.1-1+deb.sury.org~xenial+1

This ticket has been closed, because obviously vanilla PHP is not
affected. A downstream bug report has also already been filed.

Please read the full bug before commenting. Thanks!
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 16:01:29 2024 UTC