Wednesday, July 24, 2013

Blank browser page - Error: The character encoding of the plain text document was not declared

I was browsing along fine on our financial calculator pages at www.calcxml.com using Firefox 22.0. All of a sudden, the calculator input pages stopped rendering. Just a blank page would be displayed. Here is the error message I found in the Firefox error console:


Error: The character encoding of the plain text document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the file needs to be declared in the transfer protocol or file needs to use a byte order mark as an encoding signature.

After googling the error and going through several suggestions, nothing seemed to help. I was already declaring the character encoding for the web pages. Long story short, after much troubleshooting, I figured out it was the cookie length. Each of our calculators can store a cookie with the previous values used as input. I had gone through about 20 of them when the error finally occurred. I'm not sure what cookie limitations there are, but the error appeared to occur somewhere between 7600 and 7800 characters. (The error occurred with 7786 characters.)