But first it needs to be detected that the text is a plain text and not HTML, either by parsing the whole description (or by simply counting the number of <'s and >'s if it is equal, to tell it is on 90% HTML ), or by requiring a <body> or some other (<div>, <span>) tag around the description if it is written in HTML, which would be checked before converting it between text/plain and text/html.