Reputation:
I am using a rich text editor on my web application when it goes to save the data into the database it convert the ≥ into ≥. Using the WebUtility.HtmlEncode class it will not Encode ≥ into ≥ so I am not sure what is correct?
Is the rich text editor correct should ≥ encode to ≥?
Upvotes: 2
Views: 1266
Reputation: 24147
You could consider both correct, as in, that the end result (when displayed in a modern browser) will be the same.
The Rich Text Editor however could be playing it safe by not relying on its backend to correctly store and retrieve a high unicode character.
Upvotes: 1
Reputation: 40918
The point of encoding is when you want to display characters on the page that have special meaning in HTML, like if you want to display a <
and not have the browser think you are opening a new tag.
The documentation for WebUtility.HtmlEncode
describes this well:
If characters such as blanks and punctuation are passed in an HTTP stream, they might be misinterpreted at the receiving end. HTML encoding converts characters that are not allowed in HTML into character-entity equivalents; HTML decoding reverses the encoding. For example, when embedded in a block of text, the characters
<
and>
are encoded as<
and>
for HTTP transmission.
The ≥
character is not a special character in HTML, so there is no need to encode it.
Upvotes: 1