Esotropiart

Blog

first last

Textarea HTML Entity Bothers

Oh bother! In the last week or so I discovered yet another little quirk of HTML and form scripting. I just recently discovered that all mainstream browsers convert HTML entities typed within TEXTAREA elements into the characters they represent before submitting the text and when displaying the text within the TEXTAREA. For example, if I type " and submit, it will be converted to a double-quote character instead of the string of characters that represent the double-quote. In the same manner, < and > HTML entities will be converted to less than and greater than characters before being submitted in a form. Therefore, it seems very difficult or impossible to submit an HTML entity in a TEXTAREA to a PHP script in the manner described above. This is an annoying little tidbit that I was unaware of until recently. I just assumed the text in a TEXTAREA was left unchanged when submitted. I am currently in the process of writing a simple PHP script that regenerates these HTML entities in submitted HTML code based on the context of their use. It's not an easy task for me, but I'm sure I'll get it working in a while. I kinda need to get this working because I can't enter HTML entities in EsoBlog entries until I get it fixed. Annoying! I like these little challenges, furthermore. It's the best way to learn something new! I actually searched on the internet for quite some time on this topic and didn't find much, to my surprise. It seems it is one of those little known quirks of browser technology.

first last