Xml| Solutions | questions | Chinese
Problem Description: When you use PHP and Java to manipulate XML-RPC, if the request contains Chinese characters, it is automatically encoded in the following style:
Huan Huan.
Environment: PHP built-in XML-RPC Api,apache XML-RPC Java API
Workaround in PHP: Initially thought to be a Chinese character encoding problem, so I tried to encode the Chinese characters in a variety of encodings, and then gave the string Xmlrpc_encode_request (string method, mixed params) function to generate the XM L format the request, but still the same. Baffled by the world. Then the Google a god search, also did not find a solution, and later I found the http://xmlrpc-epi.sourceforge.net/this site. Just know that the original PHP document to the Xmlrpc_encode_request (string method, mixed params) function less than an optional parameter!!!! This should be true: String Xmlrpc_encode_request (String method, mixed params [, array output_options])!! The structure of the output_options is as follows:
Output_type:return data as either PHP native data types or XML encoded. Ifphp is used, then the other values are ignored. Default = Xmlverbosity:determine compactness of generated XML. Options are No_white_space, Newlines_only, and pretty. Default = Prettyescaping:determine How/whether to escape certain characters. 1 or more values are allowed. If multiple, they need to be specified as a sub-array. Options Are:cdata, Non-ascii, non-print, and Markup.default = Non-ascii, Non-print, markupversion:version of XML Vocabul ary to use. Currently, three are SUPPORTED:XMLRPC, SOAP 1.1, and simple. The keyword Auto is also recognized to mean respond in whichever version of the request came in. Default = Auto (when Applica BLE), xmlrpcencoding:the encoding that's in. Since PHP defaults to iso-8859-1 your would usually want to use that. Change it if your know what you are doing. Default=iso-8859-1
The key to the test is that on the value of the "escaping" => Array ("markup"), passing the third argument to the following value solves the problem:
Search the API provided by the Apache does not seem to find a third parameter like PHP, it is helpless to find that he provided a Base64 class, I had to put all the Chinese characters on the client side of the Base64 code, and then request to the server, Then in the server end with Base64 decoding, haha ~ ~ Problem can also be solved! But I don't know if there's any better way to do it.
Who has a better solution please contact me: qq:3470431 msn:imdishui@hotmail.com email:wangsg@asiainfo.com
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.