Jump to content

Bad Request when copy quotations from word


Reignfire

Recommended Posts

Hi,

 

I have a phpform where people can upload papers but they also need to fill in a little textbox with information about the paper. Most people copy some text from the word file straight into the textbox but if there are some quotes in it and you press submit you always get a Bad Request error page.

 

The thing is if you go to the textbox and you replace the copied quotes with quotes you type yourself it works. I know there are some problems with these "smart quotes" but i put some phpcode to replace the smart quotes with normal quotes:

$paperinfo = str_replace( array("\xe2\x80\x98", "\xe2\x80\x99", "\xe2\x80\x9c", "\xe2\x80\x9d", "\xe2\x80\x93", "\xe2\x80\x94", "\xe2\x80\xa6"), array("'", "'", '"', '"', '-', '--', '...'), $paperabstract);
$paperinfo = str_replace( array(chr(145), chr(146), chr(147), chr(148), chr(150), chr(151), chr(133)), array("'", "'", '"', '"', '-', '--', '...'), $paperabstract);

but still it isn't working. Also when i use the correct quotes and press submit it first checks for empty fields but if i use the copied quotes it isn't even checking which fields are empty it goes straight to the bad request page.

 

Hope somebody can help me with this problem.

If you get bad request, most likely your PHP is never even running. Your server may have some kind of filter enabled to reject requests with the smart quotes in them. Check your server's error logs to see if you can get a more detailed reason why the bad request error occurs.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.