php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75416 Hebrew chars don't convert as expected
Submitted: 2017-10-22 16:31 UTC Modified: 2021-02-04 18:15 UTC
Votes:2
Avg. Score:2.0 ± 1.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: chmodxwr at gmail dot com Assigned: cmb (profile)
Status: Not a bug Package: XMLRPC-EPI related
PHP Version: any OS: any
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: chmodxwr at gmail dot com
New email:
PHP Version: OS:

 

 [2017-10-22 16:31 UTC] chmodxwr at gmail dot com
Description:
------------
---
From manual page:http://php.net/manual/en/function.xmlrpc-encode-request.php

---

the convert from array to xmlrpc_encode_request dont convert the hebrew characters as need to 

after convert to xmlrpc_request 
the word שלום looks like this : 
 שלום -- wrong encoding 

the word Hello looks good
Hello



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


$array= [
            ['Server' => 'BM',
                'Method' => test,
                'Params' => ['שלום',hello,12],
            ]
        ];

$bug = xmlrpc_encode_request('Execute', $array, ['encoding' => 'utf-8', 'version' => 'xmlrpc']);


?>


Expected result:
----------------
the name: שלום looks incorrect with wrong chars

the name: hello  looks good


 <?xml version="1.0" encoding="UTF-8"?>
<methodCall>
<methodName>Execute</methodName>
<params>
 <param>
  <value>
   <struct>
    <member>
     <name>Server</name>
     <value>
      <string>BM</string>
     </value>
    </member>
    <member>
     <name>Method</name>
     <value>
      <string>test</string>
     </value>
    </member>
    <member>
     <name>Params</name>
     <value>
      <array>
       <data>
        <value>
         <string>שלום</string>
        </value>
        <value>
        <string>hello</string>
         </value>
       </data>
      </array>
     </value>
    </member>
   </struct>
  </value>
 </param>
</params>
</methodCall>

Actual result:
--------------
 <?xml version="1.0" encoding="UTF-8"?>
<methodCall>
<methodName>Execute</methodName>
<params>
 <param>
  <value>
   <struct>
    <member>
     <name>Server</name>
     <value>
      <string>BM</string>
     </value>
    </member>
    <member>
     <name>Method</name>
     <value>
      <string>test</string>
     </value>
    </member>
    <member>
     <name>Params</name>
     <value>
      <array>
       <data>
        <value>
         <string>&#215;&#169;&#215;&#156;&#215;&#149;&#215;&#157;</string>
        </value>
        <value>
        <string>hello</string>
         </value>
       </data>
      </array>
     </value>
    </member>
   </struct>
  </value>
 </param>
</params>
</methodCall>

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-10-22 16:50 UTC] kalle@php.net
-Status: Open +Status: Feedback
 [2017-10-22 16:50 UTC] kalle@php.net
Keep in note that this function is marked as 'EXPERIMENTAL'. Although I would argue that is not true anymore.

Anyway! Have you tried to set the 'escaping' option in the $output_options parameter of xmlrpc_encode_request()?
 [2017-10-23 05:34 UTC] chmodxwr at gmail dot com
-: nir at ccc dot co dot il +: chmodxwr at gmail dot com -Status: Feedback +Status: Open
 [2017-10-23 05:34 UTC] chmodxwr at gmail dot com
Hello

yes the escaping  as a "markup"  solve the problem.

their anyway  to add this to php.ini / xmlrpc.ini as a default ?

thank you 

Nir
 [2017-10-23 10:59 UTC] chmodxwr at gmail dot com
-Summary: Hebrew carecher dont convert as aspected +Summary: Hebrew chars don't convert as expected
 [2017-10-23 10:59 UTC] chmodxwr at gmail dot com
update:
on xmlrpc :
the escaping=>"markup" resolve the problem.

Now : How can I make it as a default on php.ini/xmlrpc.ini file ?
 [2017-10-25 03:34 UTC] chmodxwr at gmail dot com
-Operating System: centos 7 / windows 10 +Operating System: any -PHP Version: 7.0.24 +PHP Version: any
 [2017-10-25 03:34 UTC] chmodxwr at gmail dot com
change php version and OS
 [2021-02-04 18:15 UTC] cmb@php.net
-Status: Open +Status: Not a bug -Assigned To: +Assigned To: cmb
 [2021-02-04 18:15 UTC] cmb@php.net
> How can I make it as a default on php.ini/xmlrpc.ini file ?

To my knowledge, you can't.  Write a wrapper function, or better
stop using the XMLRPC extension[1], if you haven't already.

[1] <https://wiki.php.net/rfc/unbundle_xmlprc>
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 16:01:28 2024 UTC