Jump to content

Recommended Posts

Hi. I have a web page that allows a comment field where any charecter can be entered including  '  "  and £.

 

I enter this into a database 

`Comment` varchar(32) NOT NULL DEFAULT '',

 

When this is displayed sometimes the pound symbol is displayed as a black demimonde with a question mark. It has a ascii value of 0.

 

How can I fix this? I enter it into the database as

Comment = str_replace ( "£", "£", $Comment ) ;

 

This doesn't fix it. It works fine when i enter it into the DB as \' and \".

 

TIA

 

Desmond.

 

Link to comment
https://forums.phpfreaks.com/topic/305525-problems-with-%C2%A3/
Share on other sites

Make sure your table, your database connection, your scripts, and your web pages are all using UTF-8. At least one of them is not.

 

And don't do the str_replace() thing. Leave it as the £ character and fix the underlying problem of the character not being stored correctly.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.