0

I am trying to store the characters ♯ and ♭ in a mySQL database, but ♯ gets stored as A♯ and ♭ as Bâ™

In the HTML, I have used and ♯ and both render fine in the browser, but neither is being stored correctly.

I have tried UTF-8 and UTF-16 character sets for both the PHP page and for the field where the values are being stored and I get the same result.

I'm not very familiar with character sets, so maybe I should be using something other that UTF-8 or -16 or maybe I'm missing something else entirely?

Brian
  • 38
  • 4
  • 1
    If you have proper encoding in DB, and proper encoding on page then use `SET NAMES 'utf8'` as first query and it should solve problem. – Robert Jul 08 '13 at 06:10
  • I found my problem. It was a typo in my HTML: `` I misspelled "value" and it made a difference to have the value defined by the text inside the tags rather than from the value attribute. Works fine now. – Brian Jul 08 '13 at 07:37

1 Answers1

0

did you try to use varbinary / binary. If you have again the problem, check your DB charset, table charset, col charset, php script charset. If you have the problem after, you can use base64_(en|de)code :)

GeoffreyHervet
  • 288
  • 5
  • 16