charset issue with mysql

前端 未结 3 618
离开以前
离开以前 2021-01-27 01:01

I\'m trying to store the following line in mysql:

$data = \"After 30μs, what fraction of the charge will remain?\"

If I display $data on HTML P

3条回答
  •  无人共我
    2021-01-27 01:52

    Make sure your column's charset is utf-8, then use this method for inserting:

    INSERT INTO my_table VALUES( 
        _utf8'After 30μs, what fraction of the charge will remain?', ...
    );
    

    and this for reading:

    SELECT BINARY my_column FROM my_table;
    

提交回复
热议问题