admin管理员组文章数量:1414881
i want to encode this text from
2016, Odd Semester, Periode 1
to
2016%2C%20Odd%20Semester%2C%20Periode%201
but i can't encode the ma.
it show like this
2016,%20Odd%20Semester,%20Periode%201
here my code
var Term = '2016, Odd Semester, Periode 1'
encodeURI(Term);
i want to encode this text from
2016, Odd Semester, Periode 1
to
2016%2C%20Odd%20Semester%2C%20Periode%201
but i can't encode the ma.
it show like this
2016,%20Odd%20Semester,%20Periode%201
here my code
var Term = '2016, Odd Semester, Periode 1'
encodeURI(Term);
Share
Improve this question
asked Nov 22, 2016 at 8:59
KentgiKentgi
3181 gold badge4 silver badges15 bronze badges
4
-
4
use
encodeURIComponent
– Semi-Friends Commented Nov 22, 2016 at 9:00 -
2
or use
encodeURIComponent
instead – Thum Choon Tat Commented Nov 22, 2016 at 9:00 - 2 This function encodes special characters, except: , / ? : @ & = + $ # (Use encodeURIComponent() to encode these characters). – Kevin Kloet Commented Nov 22, 2016 at 9:01
- related post: stackoverflow./q/18251399/6908282 – Gangula Commented Nov 12, 2024 at 18:20
2 Answers
Reset to default 5Use encodeURIComponent()
:
var foo = encodeURIComponent('2016, Odd Semester, Periode 1');
console.log(foo);
Use encodeURIComponent(). It should suffice.
The encodeURIComponent() function encodes special characters. In addition, it encodes the following characters:
, / ? : @ & = + $ #
var Term = '2016, Odd Semester, Periode 1'
encodeURIComponent(Term);
本文标签: jqueryjavascript comma doesn39t encodedStack Overflow
版权声明:本文标题:jquery - javascript comma doesn't encoded - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745197363a2647207.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论