【发布时间】:2012-08-30 11:00:26
【问题描述】:
我有以下问题。我正在尝试在 Android 中使用 httppost 发送数据(我的代码看起来像这样http://www.androidsnippets.com/executing-a-http-post-request-with-httpclient)。服务器使用php获取数据,代码如下:
<?php
$fileContents = $_POST["xml"];
$fileHandle = fopen("test.xml", 'w') or die("can't create file");
fprintf($fileHandle, "%s", $fileContents);
fclose($fileHandle);
?>
它工作正常,除了文件中的非 ascii 字符很乱。当我使用 php 脚本发送数据时 - 所有非 ascii 字符都完全按照需要显示。我该怎么办?
【问题讨论】:
-
任何特殊字符?
-
xml代码中乱七八糟的部分:
%%%%%% (其中%——一些不可打印的字符),必须是география -
执行 urlencodedformentity 的部分可能会导致问题...我很确定这更适用于 http get 请求...我必须去查找几件事,秒。 ..
标签: php android encoding http-post utf