Php网络服务-结果没有显示在Android上


Php web service - results are not showing right on Android

我有一个PHP web服务,它控制我的所有数据库函数,这些函数在JSON对象中给出响应由于我使用的是希伯来语文本,所以我将所有内容都编码为UTF-8,但我所有的希伯来语文本都失去了空格。。

这是我在安卓系统中的http响应代码:

private JSONObject getApiResponse(HttpResponse response) throws Exception
{
    //get response status line
    StatusLine statusLine = response.getStatusLine();
    //if statue line is ok - read the response and return it
    if (statusLine.getStatusCode() == HttpStatus.SC_OK) {
        HttpEntity entity = response.getEntity();
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        entity.writeTo(out);
        out.close();                
        return new JSONObject(new String(out.toString().getBytes(),"UTF-8"));
    }
    return null;
}

这是我对php:的回应

    $api = new api();
    echo "<meta http-equiv='"Content-Type'" content='"text/html; charset=utf-8'">";
    echo utf8_encode($api -> processRequest()); //processRequest() always returns JSON object
  • 所有数据表均采用UTF 8
  • PHP mysqli设置为UTF 8

这是来自服务的响应示例:

{"events":[
{"Event_Code":"10212208",
 "Event_Name":"'u05de'u05e1'u05d9'u05d1'u05ea 'u05e9'u05e9        
               'u05e9'u05e0'u05d9'u05dd                             
               'u05dc'u05d1'u05d0'u05e8'u05e7'u05d9",
  "Place":"'u05d4'u05e2'u05e6'u05de'u05d0'u05d5'u05ea 84 'u05d7'u05d9'u05e4'u05d4",
  "Start_Time":"2013-08-22 21:00:00",
  "End_Time":"2013-08-23  05:00:00",
  "Facebook_Id":"741688125",
   "User_Name":"Name"}]}

知道吗??

O.k.找到了解决方案:

在阅读了Marc B的评论后,我重新检查了我的代码,发现我的一个文本视图结合了预设的英语单词和希伯来语的web服务响应。。

这导致视图由于某种原因而损坏。。。