开发者

HTML in database

开发者 https://www.devze.com 2023-03-08 03:20 出处:网络
My website has a wysiwyg editor- logged in users save text to an SQL database. When I retrieve this text later- there are occasional malformed characters.

My website has a wysiwyg editor- logged in users save text to an SQL database.

When I retrieve this text later- there are occasional malformed characters. For instance an HTML bullet point (which I suspect is an <ul> and <li> tag) - comes out as a question mark in a black diamond.

Is the wysiwyg editor spitting out bad code? I did use nicEdit- I know ti开发者_开发技巧nyMCE is better, but nicEdit is really light-weight. I'll switch if I have to.

Or should I run the text through some kind of filter function?

My pages are build w/ PHP- any idea how I can fix this bug?


Probably do both:

a) switch to a Wysiwyg editor that produces valid xhtml to start with, and

b) parse/validate/sanitize whatever is being sent by the end-users (using html purifier, php's dom library, or other) before storing it.

0

精彩评论

暂无评论...
验证码 换一张
取 消