DecodeURIComponent不支持少数编码组件
我正在用json的公告格式发送JD,格式为restapi。所以我对jd进行编码并发送。这工作正常,没有任何问题。但当我试图解码编码的JD时,我得到了错误,因为URI格式不正确
var jd = "Where are bullets most often used?
- Technical writing
- Reference works
- Notes
- Presentations";
var json ={
"job":encodeURIComponent(escape(jd));
}
解码:
var jd = decodeURIComponent(jd);
这是我收到的回复。
Where%20are%20bullets%20most%20often%20used%3F%0A%uF0B7Technical%20writing%0A%uF0B7Sub%20bullet%0A%uF0B7Reference%20works%0A%uF0B7Notes%0A%uF0B7Presentations%0A%uF0B7Lists%0AAn%20alternative%20method%20is%20to%20use%20a%u807Dnumbered%20list%3A%0A1.Technical%20writing%0A2.Reference%20works%0A3.Notes%0A4.Presentations%0A5.Lists