因为quick v3 中安卓的http请求和 windows ios的平台不一样。其中安卓用的是java自己的。在
安卓cocos2d 库中
QuickHTTPInterface的 postContent中
DataOutputStream out
中 out.writeBytes(content); 但是如果这样
那么我content如果是中文就会出现服务端 php得到的内容是乱码
我把这条改成 out.write(content.getBytes()); 这样中文数据就能正确读取了
附上源代码。。
static void postContent(HttpURLConnection http, String name, String value) {
try {
DataOutputStream out = new DataOutputStream(http.getOutputStream());
String content = null;
Log.v("postContent2", value);
if (null == name || 0 == name.length()) {
content = value + "&";
} else {
content = name + "=" + value + "&";
}
Log.v("postContent2", content);
//out.writeBytes(content);
out.write(content.getBytes());
out.flush();
} catch (IOException e) {
Log.e("QuickHTTPInterface", e.toString());
}