Page 1 of 1

[RESOLVED]pasting from MS Word into a form

Posted: Tue May 04, 2010 12:01 pm
by andym01480
Copying text from a received email into a form that runs a (secure!) php mail script resulted in this
You don’t
Where a ' got translated badly.

I can see that you would need to define the character set of the page that holds the form - but pasted stuff will still go bad...

Code: Select all

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- within a wordpress plugin!

What is the best way of stopping that kind of nastiness?

Re: Weird characters in an email script

Posted: Tue May 04, 2010 12:56 pm
by flying_circus
What is the character set of your received email?

Re: Weird characters in an email script

Posted: Tue May 04, 2010 1:20 pm
by andym01480
Couldn't tell you offhand - but it came from a pc doofus, so whatever is out of the box UK English office 2003

Is there a way of sorting any other character set, because the same happens copying and pasting from Word docs.

Re: Weird characters in an email script

Posted: Wed May 05, 2010 3:42 am
by andym01480

Code: Select all

 mb_convert_encoding(nl2br($_POST['text']), 'HTML-ENTITIES', 'UTF-8') 
has done the trick nicely

Re: [RESOLVED]pasting from MS Word into a form

Posted: Wed May 05, 2010 4:02 am
by timWebUK
You can always copy and paste into Notepad, then into the form.

Re: [RESOLVED]pasting from MS Word into a form

Posted: Wed May 05, 2010 8:29 am
by andym01480
You could, but that doesn't make for great usability!

The above posted code snippet worked for a piece of text with heading1, curly quotes and bullets, so will do me