1
我有控制我的所有的数据库功能,因为我使用的是给出了JSON对象 我编码成UTF-8一切的方式响应的PHP Web服务希伯来文 - 但我所有的希伯来文失去其空间..的PHP Web服务 - 结果不正确显示在Android
这是我的Android 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"}]}
任何想法??
我是盲人或做'... \ u05ea \ u05e9 ...'在它的空间?不知道你在... –
它呢...但在我的android屏幕上,那些空间不见了 –
也许我应该用URL等其他编码来包装内容? –