传输换行符“\n”
给定以下 URL(有效,尝试一下!)
https://select-test.wp3.rbsworldpay.com/wcc/purchase?instId=151711&cartId=28524¤cy=GBP&amount=1401.49 &testMode=100&name=Tom%20Gul&address=24%20House%20Road\n一些 地点\n县&邮政编码=TR33%20999&[电子邮件受保护]&国家/地区=GB
如果您点击链接并进入付款页面,地址框中的地址无法正确显示,换行符显示为文本。
我尝试过
,但没有成功,有人有什么想法吗?我需要获取以换行符显示的地址。
's
逗号可以作为分隔符,但我更希望能够有换行符。感谢您的帮助!一个有效的例子将是被接受的答案。
Given the following URL (working, try it!)
https://select-test.wp3.rbsworldpay.com/wcc/purchase?instId=151711&cartId=28524¤cy=GBP&amount=1401.49&testMode=100&name=Tom%20Gul&address=24%20House%20Road\nSome
Place\nCounty&postcode=TR33%20999&[email protected]&country=GB
If you click on the link and go through to the payment page, the address in the address box is not displaying properly, the newline characters are displaying as text.
I've tried passing through <br />'s
but no luck, anyone got any ideas? I need to get the address to display with newlines.
Commas are OK as a separator but i would much prefer being able to have newlines. Thanks for any help! A working example will be the accepted answer.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
尝试在 URL 中使用
%0A
,就像使用%20
代替空格字符一样。Try using
%0A
in the URL, just like you've used%20
instead of the space character.尝试将
\n
替换为%0A
,就像将空格替换为%20
一样。Try to replace the
\n
with%0A
just like you have spaces replaced with%20
.使用
%0A
(URL 编码)而不是\n
(C 编码)。Use
%0A
(URL encoding) instead of\n
(C encoding).聚会迟到了,但如果有人遇到这个,javascript 有一个
encodeURI
方法late to the party, but if anyone comes across this, javascript has a
encodeURI
method将 \n 替换为 %0A。
就这样。
Replace the \n with %0A.
That's all.