Jump to content

[SOLVED] replacing special characters


purplenewt

Recommended Posts

hi I kind of know what I need to achieve here just not sure how to accomplish it. Basically I have a text box and when users type into it it doesnt seem to understand characters like pound signs and things, so to fix this problem i am thinking some code that basically does something like:

 

If £ found

replace £ with £

 

and then repeat that for several character types but im just not sure how to go about it.

 

Any help would be greatly appreciated, thanks.

 

Purplenewt

Link to comment
Share on other sites

thanks a ton I followed the link you gave and found a better way to get the job done than I had thought of.

 

I was thinking I would have to do a lot of if else type coding for each character that wasn't displaying properly, on the link you gave me I found:

 

// Provides: You should eat pizza, beer, and ice cream every day
$phrase  = "You should eat fruits, vegetables, and fiber every day.";
$healthy = array("fruits", "vegetables", "fiber");
$yummy   = array("pizza", "beer", "ice cream");

$newphrase = str_replace($healthy, $yummy, $phrase);

 

which with a small amount of editing has saved me a ton of coding.

 

now I just have to find out how to mark this thread as solved:)

 

Thanks again

 

Purplenewt

Link to comment
Share on other sites

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.