国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開APP
userphoto
未登錄

開通VIP,暢享免費電子書等14項超值服

開通VIP
PHP和JAVA的XML-RPC中文問題解決辦法

PHP和JAVA的XML-RPC中文問題解決辦法

     問題描述:
      在使用PHP和JAVA操作XML-RPC的時候,如果request中包含中文字符,會被自動編碼成如下樣式:

欢欢 。

      環(huán)境:PHP內置XML-RPC的API,Apache的XML-RPC的JAVA API

      PHP下的解決方法:
      起初以為是中文字符的編碼問題,所以我就嘗試用各種編碼方式來編碼中文字符,然后交給string xmlrpc_encode_request ( string method, mixed params)函數來生成XML格式的請求,可是依然如故。百思不得其界。便操其Google 一通神搜,也沒找到解決辦法,后來我找到了http://xmlrpc-epi.sourceforge.net/這個網站。才知道,原來PHP文檔里給的xmlrpc_encode_request ( string method, mixed params)函數少了一個可選參數?。。?!正確的應該是這樣的:string xmlrpc_encode_request(string method, mixed params [, array output_options])?。utput_options的結構如下:

$output_options = array(
                       "output_type" => "xml",
                       "verbosity" => "pretty",
                       "escaping" => array("markup", "non-ascii", "non-print"),
                       "version" => "xmlrpc",
                       "encoding" => "utf-8"
                      );
or

$output_options = array("output_type" => "php");

原文說明如下:

output_type: return data as either php native data types or xml encoded. ifphp is used, then the other values are ignored. default = xml

verbosity: determine compactness of generated xml. options are no_white_space, newlines_only, and pretty. default = pretty

escaping: 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, markup

version: version of xml vocabulary to use. currently, three are supported: xmlrpc, soap 1.1, and simple. The keyword auto is also recognized to mean respond in whichever version the request came in. default = auto (when applicable), xmlrpc

encoding: the encoding that the data is in. Since PHP defaults to iso-8859-1 you will usually want to use that. Change it if you know what you are doing. default=iso-8859-1

經過測試關鍵是在"escaping" => array("markup")這個值上,將第三個參數傳入如下值就可以解決問題了:

$output_options = array(
                       "output_type" => "xml",
                       "verbosity" => "pretty",
                       "escaping" => array("markup"),
                       "version" => "xmlrpc",
                       "encoding" => "utf-8"
                      );


      Apache JAVA XML-

本站僅提供存儲服務,所有內容均由用戶發(fā)布,如發(fā)現有害或侵權內容,請點擊舉報。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
WordPress 關閉 XML-RPC 的 pingback 端口
PHP中使用XML-RPC構造Web Service簡單入門
從R中調用Cytoscape繪制復雜網絡
探討C 、C#和JAVA:webservice互操作問題
JAX-WS2.0規(guī)范--第一章
j2ee web service開發(fā)(一) 映射數組復雜類型 - 一切從實用出發(fā)! - B...
更多類似文章 >>
生活服務
分享 收藏 導長圖 關注 下載文章
綁定賬號成功
后續(xù)可登錄賬號暢享VIP特權!
如果VIP功能使用有故障,
可點擊這里聯系客服!

聯系客服