.Net Editor library is encoding text when writing to DB
.Net Editor library is encoding text when writing to DB
kevan.watkins
Posts: 22Questions: 5Answers: 0
in Editor
I am using Editor .NET Framework libraries v1.8.1 and mssql server.
When Editor writes to a varchar() field, the text is html encoded
i.e. "&" is written as "&"
Is there a way to disable this encoding?
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
I can solve it by adding the following to each text field:
.SetFormatter((val, data) => System.Net.WebUtility.HtmlDecode(val.ToString()))
Is there a better way?
I have no idea how similar the .NET library is to the PHP library, but this is my own note from a PHP Model using the Editor:
(chained from a Field::inst('last_name')).
Might be some help.
The libraries are all intentionally very similar. There are platform differences, like the .NET one uses Microsoft's own XSS protection filter rather than a third party one such as htmLawed. however, the same would be true here, if you aren't worried about XSS attacks then
.Xss( false )
for the field would be what to use for .NET.Allan
Thank you both.
That answers my question.
I don't see how to mark it as Answered.
The thread was opened as a discussion rather than a question. I've changed that now and marked it answered .
Allan