After having succesfully added an image to my HTML Editor Extender, when I save it to the database the html becomes invalid, basically it escapes the HTML (i.e. so < becomes < and > becomes >) thus destroying the <img src=""> tag
Note:
This only happens with the <img src=""> the rest of the html is left unscathed. which I find rather strange.
Comments: Probably the src attribute contains backslash characters. The current HtmlEditorExtender.Decode method does not recognize the attribute value (e.g. ".\Images\MyImage.jpg") as a valid one. Adding the backslash to the attributeCharacters will fix the issue. Imo an backslash within the attribute value cannot harm. HtmlEditorExtender.cs public string Decode(string value) { .... //string attributeCharacters = "\\'\\,\\w\\-#\\s\\:\\;\\?\\&\\.\\-\\="; string attributeCharacters = "\\'\\,\\w\\-#\\s\\:\\;\\?\\&\\.\\-\\=\\\"; .... }
Note:
This only happens with the <img src=""> the rest of the html is left unscathed. which I find rather strange.
Comments: Probably the src attribute contains backslash characters. The current HtmlEditorExtender.Decode method does not recognize the attribute value (e.g. ".\Images\MyImage.jpg") as a valid one. Adding the backslash to the attributeCharacters will fix the issue. Imo an backslash within the attribute value cannot harm. HtmlEditorExtender.cs public string Decode(string value) { .... //string attributeCharacters = "\\'\\,\\w\\-#\\s\\:\\;\\?\\&\\.\\-\\="; string attributeCharacters = "\\'\\,\\w\\-#\\s\\:\\;\\?\\&\\.\\-\\=\\\"; .... }