Jump to content

Bad Request when copy quotations from word


Reignfire
Go to solution Solved by kicken,

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.

Link to comment
Share on other sites

  • Solution

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.

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.