Jesdisciple
06-03-2009, 07:05 PM
EDIT: Sorry, I was using an undefined variable. This bug was somewhere between the chair and the keyboard.
PHP is getting me frustrated with their (raw)urlencode function. I have an email form, and I'm trying to prepare for the mail function's failure by giving an error message which contains a mailto link. The link passes the subject and body to the email client via GET - admittedly not a critical feature, but AFAICT it should work perfectly.
URLs are written only with the graphic printable characters of the US-ASCII coded character set. The octets 80-FF hexadecimal are not used in US-ASCII, and the octets 00-1F and 7F hexadecimal represent control characters; these must be encoded.
My problem is that the newline characters (carriage return and linefeed) aren't encoded, even though they (0D and 0A) are included in 00-1F. I tried replacing them myself with their codes (%0d and %0a), but both str_replace and the other two functions just spit out an empty string when they hit these characters. That is, unless I type them directly into a double-quoted string.
Does anyone have an idea for how to work around this? (I think this is the third PHP bug I've found since I finally fixed my computer a few days ago.)
PHP is getting me frustrated with their (raw)urlencode function. I have an email form, and I'm trying to prepare for the mail function's failure by giving an error message which contains a mailto link. The link passes the subject and body to the email client via GET - admittedly not a critical feature, but AFAICT it should work perfectly.
URLs are written only with the graphic printable characters of the US-ASCII coded character set. The octets 80-FF hexadecimal are not used in US-ASCII, and the octets 00-1F and 7F hexadecimal represent control characters; these must be encoded.
My problem is that the newline characters (carriage return and linefeed) aren't encoded, even though they (0D and 0A) are included in 00-1F. I tried replacing them myself with their codes (%0d and %0a), but both str_replace and the other two functions just spit out an empty string when they hit these characters. That is, unless I type them directly into a double-quoted string.
Does anyone have an idea for how to work around this? (I think this is the third PHP bug I've found since I finally fixed my computer a few days ago.)