Haroldo
Haroldo

Reputation: 37377

How do i store £ symbols in UTF-8 MySQL

I have all MySQL dbs, tables and cols set to utf8_general_ci.

If i use phpMyAdmin to put a £ symbol into a row, when i display it on a utf-8 charset page i get the good old question-mark-diamond.

However on the same page, if i put <?php echo 'pound symbol test: £' ?>, the symbol displays correctly, so the problem must be with the MySQL not the page.

If i dump my database and add a £ using my text editor (set to UTF-8) and then re-import, same problem as with adding the £ in phpMyAdmin

alt textalt text

Upvotes: 0

Views: 2210

Answers (3)

Robert
Robert

Reputation: 1

Victory is MINE!!

I've just sent about 30 minutes trying to figure this out, and came up with this. Possibly not the best solution, but it works!!

html_entity_decode(htmlentities('£250 to £1000',ENT_COMPAT, 'UTF-8', false), ENT_COMPAT, 'ISO-8859-1')

Upvotes: 0

ajreal
ajreal

Reputation: 47321

Check phpmyadmin wiki

No doubt phpmyadmin is convenient,
but I would recommend use command line
(this give yourself a chance to sharpen your sql knowledge)

Upvotes: 1

Pekka
Pekka

Reputation: 449525

Is your database connection UTF-8 encoded?

Try sending a query:

SET NAMES utf8;

after opening the connection.

Upvotes: 1

Related Questions