FRIHOSTFORUMSSEARCHFAQTOSBLOGSCOMPETITIONS
You are invited to Log in or Register a free Frihost Account!


[PHP] HTML entities, inputs, quotes





simplyw00x
I co-run a music site, free-magazine.co.uk. We have members submit their own articles, then they are approved and make it into the main website.

The problem is that most users write their articles in Word and copy and paste them into the textarea. Because Word replaces " with curly brackets, whilst they appear fine in the text editing area, they become ? in IE and 'entity not found' symbols in Firefox.

I have found 2 solutions:
1. Have users re-type all curly quotes, hyphens and em dashes in the textarea before submitting.
2. Change the setting in Word not to autocorrect to curly quotes.

The problem is my users are lazy and stupid and either can't or won't do either of these, and my editor is getting pissed off.

What I want to know is if there's a way of replacing these characters; surely it's not as easy as str_replace?
mathiaus
simplyw00x wrote:
surely it's not as easy as str_replace?


thats exactly what I use and it works a treat. Copy an annoying curly brackey from word and then replace with a straight one Smile

Code:
<?php
$message = "... and I said ‘right’.";
$old = array("‘", "’");
$new = str_replace($old, "'", $message);
echo $new;
?>
simplyw00x
I was scared it was going to screw things up properly. Thanks a lot.
Related topics
PHP or HTML
php/HTML pages question
RSS Generator script
SSI within php coded files
php dil çevirmede yardým edin lütfen
How to upload a file via html-form and php?
How to change extension php to html but the php script still
php html tags
Make me a job application page in php and earn 110 FRIH$!
If you have created a form on your site you can help...
SOLVED::PHP upload_max_filesize
Wanting a PHP input security script: up to 1200frih$!
javascript php html styling and good practice.
Embed PHP+HTML
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.