Php 为什么';t webservice支持重音字母?
我将Php 为什么';t webservice支持重音字母?,php,mysql,web-services,java-me,wsdl,Php,Mysql,Web Services,Java Me,Wsdl,我将wsdl文件中返回值的datatype设置为xsd:anyType: <message name="getEtapeProspResponse"> <part name="return" type="xsd:anyType"/> </message> 在数据库中,“etape_prosp_comment”的值有一个重音字母e。 问题是,当我从J2ME应用程序调用webservice时,会引发异常。但是如果我没有在列中插入任何带重音的字母,那么We
wsdl
文件中返回值的datatype
设置为xsd:anyType
:
<message name="getEtapeProspResponse">
<part name="return" type="xsd:anyType"/>
</message>
在数据库中,“etape_prosp_comment”的值有一个重音字母e。
问题是,当我从J2ME
应用程序调用webservice时,会引发异常。但是如果我没有在列中插入任何带重音的字母,那么Web服务就可以了
那么如何解决这个重音字母问题呢?文本包含像a、b、c、d、e或é(在您的例子中)等字符。系统支持的所有字符一起构成一个字符集。然后,字符编码定义了如何将字符序列化为字节表示形式(值是什么、值将存储多少字节等)
这就是编码中的问题所在。您的字符被转换为字节,然后从字节中您必须返回字符。如果web服务和客户端不使用相同的字符编码,则web服务无法将客户端的字节转换为字符,反之亦然;您将得到错误或格式错误的字符串
我不是PHP开发人员,但下面的文章包含一些有关解决此问题的相关信息:
那篇文章引用了另一篇关于字符集的好文章(虽然有点旧,从2003年开始):,所以一定要先读这篇文章
您应该使用UTF-8编码,这主要是因为这是《web服务互操作性指南》以及UTF-16;规定的编码 我不是php专家,但也许你可以对信息进行编码。在处理Web服务时,特殊字符可能一直是个问题。会引发哪个异常?您从服务器收到的XML消息是什么样子的?您的意思是重音字符
。重音应该更接近于“粗体”、“斜体”等等。。。您是否检查了整个http管道(客户端->php->数据库->php->客户端)中的字符集是否匹配?该链中任何位置的字符集的单个更改都会损坏数据。
function getEtapeProsp($user,$motpasse)
{
$user_code = verifyUser($user, $motpasse) ;
$resultat="";
if ( $user_code != null)
{
$datejour = date("Y-m-d");
$connec = mysql_connect("192.168.1.123:3306", "root", "mysqlroot");
mysql_select_db("finance",$connec);
$query = mysql_query("SELECT * FROM etape_prospection INNER JOIN type_prospection ON etape_prospection.type_prosp_id = type_prospection.type_prosp_id WHERE prosp_id IN (SELECT prosp_id FROM transfert WHERE user_code ='".$user_code ."' AND date_transfert='".$datejour."') order by etape_prospection.prosp_id");
while($ligne = mysql_fetch_array($query))
{
$resultat .= $ligne['etape_prosp_id'].';';
$resultat .= $ligne['type_prosp_lib'].';';
$resultat .= convertDateFormatHH($ligne['etape_prosp_date']).';';
$resultat .= $ligne['etape_prosp_comment'].';'; // this is the text column
$resultat .= $ligne['prosp_id'].';';
$resultat .= "\r\n";
}
}
else
{
$resultat = "Login ou mot de passe incorrect" ;
}
return $resultat;
}