doutangqi4444 2015-11-06 16:50
浏览 29

离子编码不能与php发布

im trying to do a post to a php and save in a mysql database

this is the ION.with command:

Ion.with(this)
                            .load("http_my_page/test.php")
                            .setBodyParameter("text", "não")


                            .asString(Charset.defaultCharset())//default=UTF-8
                            .setCallback(new FutureCallback<String>() {
                                @Override
                                public void onCompleted(Exception e, String result) {

                                }


                            });

my test.php page:

<?php
$test  = $_POST["text"]; 
$servername = ...;
$username = "..";
$password = "...";
$dbname = "...";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
} 

$sql = "INSERT INTO test (my_test) VALUES ('$test')";

if ($conn->query($sql) === TRUE) {
    echo "New record created successfully";
} else {
    echo "Error: " . $sql . "<br>" . $conn->error;
}

$conn->close();
?>

and my MYSQL database has a column called my_test and collation is UTF8_unicode_ci

what im specting to store: "não"

what it really store: "não"

any reason? since im setting all the econdings =(

  • 写回答

1条回答 默认 最新

  • dstjh46606 2015-11-07 12:07
    关注

    That was a PHP/MYSQL encoding issue and nothing related to Ion

    $conn->set_charset("utf8");
    
    评论

报告相同问题?

悬赏问题

  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题