cgiemail text corruption with tab and Windows line endings
I'm seeing a really odd issue recently with a simple cgiemail script where text in the email is becoming corrupt. Googling didn't turn up anything similar, and the problem has just appeared recently after over a year of using this script with no trouble... so I'm wondering something on Bluehost's servers could have changed that would cause this. Ring a bell to anyone?
Details: I have a simple cgiemail .txt file set up so that an app can ping the server with an error report, which emails the developers. We start with a Java string and URL-encode it, then POST the string up to the cgiemail script. If the string contains both \t and \r -- that is, a tab character and a Windows-style "CRLF" line ending -- then the text in the resulting email message is corrupted.
Here's a simple example:
- Java string: "1234\r\n\tAbcdefghijklmnopqrs"
- Content that is POSTed to the cgiemail URL: "feedback=1234%0D%0A%09Abcdefghijklmnopqrs"
- Text in the email that cgiemail generates: ..."Abcdefghijklnnopqrs" -- notice the doubled "n" and missing "m"
It seems like each CRLF-tab sequence causes the next line of text to be corrupt, with missing and/or doubled characters. If I change one random line to use LF (Mac/Unix-style line ending) instead, then that one line will be correct.
Obviously, I can change all our Java apps to convert all line endings before sending the text, but they've never done that before and everything worked fine up until now. So I'd ideally like to understand what has changed recently to make it stop working. Has anyone seen / heard of anything like this?
Thanks for any help!