Disable html entities in api
-
@Julian
let's show this topic's api:
https://community.nodebb.org/api/topic/17754/the picture below shows return data, please note the part marked in red, it should be "GNU/Linux", but now is "GNU/Linux". Character '/' has been replaced by '/'.
So is there have a option let me to disable this ?
sorry for bad English guys, and thanks a lot.
-
Similar question answered here:
https://community.nodebb.org/topic/17742/how-to-easily-convert-api-data-to-html-in-a-general-fashion/5?_=1704272984890 -
@haizhi "unescaping" HTML entities is fairly simple even without a full JS environment - it's essentially just find-and-replace with a dictionary.
More specifically, you should only need to replace:
&
with&
'
with'
<
with<
>
with>
/
with/
\
with\
`
with`
I'm not sure what WeChat mini programs are written in (quick google search in English yielded just marketing for how good they are... not how they're made), but I assume you should be able to do some kind of
string.replace
.And it's quite likely the standard library of your language or some other library you're using will have a functions to do that already. E.g. python has
html
module, C# has HttpUtility.HtmlDecode, for Java a lot of libraries (e.g. Apache Commons or Spring) provide something, etc.