Automatic transcoding of data parameters submitted by post

A project you are working on requires rich text functionality, which is transcoded using the "encodeURIComponent" method when you submit, but will the browser automatically decode it when you send a request?

meeting description

has been converted to % 3Cp%3E%E4%BC%9A%E8%AE%AE%E6%8F%8F%E8%BF%B0%3C%2Fp%3E


Why is it transcoded automatically?

Update

params.des=encodeURIComponent("

");//%3Cp%3E%E4%BC%9A%E8%AE%AE%E6%8F%8F%E8%BF%B0%3C%2Fp%3E

send a request to the background

//nodejs
BaseJs.ajaxV3Proxy(meetingTask.path+"url",params, function(json) {
    if(json == "OK"){
        that.$Message.success("!");
        that.loading=false;
        that.$router.push({name:"meetList"});
    }
});

the above is relatively simple, can be saved successfully, plus the background color will be 500 error
for example:

<span style="color: rgb(230, 0, 0);"></span>

Apr.09,2021

is the parameter passed incorrectly

"desc" : "

<span style='color: rgb(230, 0, 0);'></span>

" //style // "desc" : '

<span style="color: rgb(230, 0, 0);"></span>

'

does browser automatic transcoding affect rich text functionality?

if there is
, you can change the way of thinking. The front end first converts the content to base64 encoding, and then sends it to the back end
. If the back end can store base64, directly, the front end wants to show that it is decoding base64 normally

.

because the default content-type is application/x-www-form-urlencoded , the browser will escape the content you want to post. You can switch to another type, such as FormData or application/json , text/plain and so on.

Menu