I'm looking for a better way to do some kind of smart HTML encoding. For example:
From: <a>Next >></a> to: <a>Next gt;gt;</a> From: <p><a><b><< Prev</b></a><br/><a>Next >></a></p> to: <p><a><b><< Prev</b></a><br/><a>Next gt;gt;</a></p>
This way, only part of the non-XML / HTML text will be encoded as if HtmlEncode was being called.
Any suggestions?
EDIT: this should be as easy as possible. Incoming text will come from users who do not know the HTML encoding.
Yes: never write HTML in your source code. Instead, work with the API as a DOM, which takes care of all the encoding issues for you.
# ( ), HTML Agility Pack. HTML. , , , , .
, JQuery. . HTML jQuery.
, . ( , , .)
unencoded >> << HTML, , , <> <b>, . (, XSS.)
>>
<<
<>
<b>
, HTML. , , . .
: , , HTML . , HTML, , - HTML- . HTML , , , HTML. , , .
tidy.net? , , , , -, . DLL , , .
, . ( , ), , , , . , , - , .
I would probably try to write a good regex for this. Are you doing this in code behind (C #) or client side with JavaScript?
http://www.regular-expressions.info/
Source: https://habr.com/ru/post/1714304/More articles:Download Picture OnClick - htmlWCF and IIS 6 - WSDL Unaffected - wsdlNearest neighbor "pixelly" texturing in Cocos2d? - iphonehow to insert image in db like blob in zendframework - phpВызов клиента soap.NET - c#JPA EntityManager deletes all records in the database - javaHow to delete a line from a text file based on "studentId"? - javaКак использовать другой STL с g++ - c++c differences in row distribution? - cFile open mode malfunction between C # and C ++ - c #All Articles