If I escape some code because I want it to display as the actual code in html (eg for an example code snippet), save it to the database and then pull it back to the editor (an html page), it is displayed as html, as opposed to the escaped text.
My problem arises when I include a textarea tag in the text because it will prematurely close the editing area and chop off the rest of what I write when it is saved (or more if I don't close the tag).
So my question is: Is this intended behavior on the part of the browser? -> So I need to escape the text (code and pre tags perhaps)? every time I want to make changes to it? Or am I doing something wrong?
*Note I am the only person using this and it is mostly just for learning, so I am not worried about the security aspect so much as the way in check I need to handle my html when using it in a browser and have it behave in an expected way.