【发布时间】:2011-11-23 10:57:41
【问题描述】:
我有一个发送 html 页面内容的 PHP SOAP 服务器(使用 nuSOAP 和 wsdl)。当然,可以使用不同的编码对 HTML 进行编码,这就是问题出现的时候。如果我使用 PHP SOAP 客户端,我可以像这样发送编码:
$clienteSOAP = new SoapClient ("http://test.mine.com/wsdl/filemanager?wsdl",
array ('encoding' => 'ISO-8859-15'));
$clienteSOAP->__soapCall ("Test.uploadHTML",
array (file_get_contents ('/home/КОЛЛЕКЦИЯ_РОДНИК_ПРЕМИУМ.html')));
如果我输入了正确的编码,到目前为止从未失败过。但是当我使用 C# 客户端时,如何将编码放入 Web 服务请求中?在 C# 中,代码是:
System.IO.StreamReader html = new System.IO.StreamReader (
"C:\\Documents and Settings\\КОЛЛЕКЦИЯ_РОДНИК_ПРЕМИУМ.html"
,System.Text.Encoding.GetEncoding("iso-8859-15"));
string contenido = html.ReadToEnd();
html.Close();
Test.FileManager upload = new Test.FileManager();
string resultado = upload.TestUploadHTML (contenido);
Test.FileManager 是 wsdl 的 Web 引用,当我看到“上传 html”时,有些字符不正确。
提前致谢。
【问题讨论】: