Specifically, suppose I start with the string
string ="hello \'i am \' me"
And then I textilize the string to get an output:
textilize(string) => "<p>hello ’i am ’ me</p>"
And then, because I want to get a count of the characters visible to a person, I wish to strip the html tags, and reverse the special characters ’ to the simple apostrophe they are (ie ' or \'). Strip_tags is easy enough:
strip_tags(textilize(string)) => "hello ’i am ’ me"
But I don't know how to reverse the special characters. If it helps, I know the method html_escape would have turned some characters like angle brackets into the decimal form:
html_escape(">") => ">"
But I don't know of a rails method to reverse this. Anyone have suggestions on either a custom method or a rails method to accomplish this task?