0

im having a string like this which im trying to save to my mysql database

$str = "The size id 9” x 12” and some other";

here the is not the regular "

Its a part of an Ajax response,In the php side this is what im using

header("Content-Type: text/html; charset=utf-8");
echo $this->_helper->json(array("string is" => $str));

My but console shows 9[a sqaure box] x 12[a square box] //actually a square box cant able to paste it

And im saving this string to my database which has the charset utf8mb4 which is also not correct (ignores the ” in the table while saving)

Can somebody show me which charset i need to use for both showing in html and saving in mysql

coolguy
  • 7,866
  • 9
  • 45
  • 71
  • Most character encodings will do the job. Any Unicode encoding definitely will do the job. The trick is using it properly from end to end. – Quentin Dec 10 '14 at 11:12

1 Answers1

0

utf8_encode will do the trick.

Then utf8_decode when you print.

Antony D'Andrea
  • 991
  • 1
  • 16
  • 35