PHP Chinese garbled solution

Source: Internet
Author: User
PHP Chinese garbled
A simple database insertion interface and background
Add.html


Backstage add.php

$workcontent = $_request["Workcontent"];
$contact = $_request["Contact"];
$remark = $_request[' remark ');

Include ' conn.php ';

$sql = "INSERT into workcontenttable (Workcontent,contact,remark) VALUES (' $workcontent ', ' $contact ', ' $remark ')";
$issuccess = @mysql_query ($sql);
if (!issuccess) {
echo "Add not successful! ";
}else{
$str = "added a piece of data, business content:" + $workcontent + ", contact person:" + $contact + ", notes:" + $remark;
Echo $str;
}
?>

MySQL encoding is the default Utf-8

Operation in Firefox browser, MySQL normal display for Chinese
Operation in IE, MYSL Chinese garbled

add.php?workcontent= Test &contact=test&remark=ss
Firefox and IE both echo out garbled

My PHP Novice This Chinese garbled problem really tangled
All the methods I've tried on the internet are useless. iconv function after transcoding to empty string PHP MySQL

Share to:


------Solution--------------------
Have encountered similar problems, do not understand the reasons, I was so


$charTest;

if ($tag = = = Iconv (' UTF-8 ', $c, Iconv ($c, ' UTF-8 ', $tag))) {//conversion encoding is not equal
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.