I have a custom administration page to allow editors to manage terms and conditions. When I attempt to copy text from a particular Word document, I get a Internal 500 server error. If I remove the letter "r" entirely from the copy, it works. I know this is a server error, not a Drupal code error since it works on my localhost, but not on my staging server. The form is a simple textarea, not CKEditor or TinyMCE. I get the same error if I put the copy in a node.

What causes this issue on the server level? Is there anything I can do on the Drupal level to prevent the issue?

Any help on the matter would be greatly appreciated.

Comments

Jonakun’s picture

I am curious on how you decided to remove the letter r from your document to make it work...?

theabacus’s picture

Pure frustration.

Actually, I was using preg_replace for about an hour stripping out character ranges and figured out that "r" was the cause. Oh, and it isn't the letter "r", it is particular instances of the letter (I assume different character code). Perhaps ligatures?

wstein’s picture

In programming courses, the binary search algorithm is often taught, and when I just can't find the cause of a problem like this, I find that a manual binary search is the fastest way to track it down...

Take your Word document, and copy the First Half into your Drupal form and try it...
If you get no problem, then copy the Second Half into your form.

Whichever half got the error, just divide that part in half again when you copy out of Word, and repeat until you have a fairly small chunk of text that still causes the error... This should only take 4 or 5 repetitions. (Recognize that you MAY happen to divide the source of the problem in half at some point, resulting in two halves where neither half reproduces the problem... if so, change the division point until you retain the source of the error on one side or the other.)

Now, examine the clipboard contents and determine what is weird about it.
(Perhaps Clipboard Spy would be a good tool for this job: http://www.delphidabbler.com/software/cfs/scr?mid=2 )