3 回答
You should specify the encoding in the android code:
httpPost.setEntity(new UrlEncodedFormEntity(params, "UTF-8"));
Otherwise it will be ISO-8859-1.
On the PHP side, do not do any conversion such as utf8_decode/encode
, these will always just make it worse.
Also fix your http header:
<?php
header('Content-Type: application/json; charset=utf-8');
print_r($_POST);
Why don't you try to transform it into html sign? Like $#numbers;
. If not than state encoding like utf-8 general_ci
or ANSI
. it helped me once.
Just for your curiosity... i finally fix the problem. I miss to add th charset the db have to use so i put:
$conn = oci_new_connect($userDb, $pswDB, $urlDb, 'AL32UTF8');
instead
$conn = oci_new_connect($userDb, $pswDB, $urlDb);
So Android have:
httpPost.setEntity(new UrlEncodedFormEntity(params, "utf-8"));
In Php i have:
header('Content-Type: application/json; charset=utf-8');
(don't know if this is important)
This is all..ty all for help