NOTICE: Find more in my tech blog: liopic.me.
I imagine a string looking at itself, thinking “is this quote a part of myself or my end?” ;-), like the mirror in the clever drawing made by Jesús (he is a really fantastic artist, you should take a look at his new drawings). What happens when the limit of something is a part of itself? What happens when you see your limit is a part of yourself? Then you can change it, openning it!
By the way, most programmers do the laziest focus: to not allow the user to introduce quotes. But I think it’s the wrong solution, because it’s not a solution at all, but a patch. The professional way to do this is to implement a real solution, so the user can do what he/she wants. You are the person who has to spend time thinking, and not the opposite. This is the reason of this post: I spent the whole day trying to solve this problem in the most elegant form, in a AJAX-powered CMS I’m working on.
Update: At Sunday night I got it. Now I have an “edit in place” system with support of quotes marks, with an easy plus elegant code 🙂