Transmitting newline character “\n”

江枫思渺然 提交于 2019-12-03 18:24:36

问题


Given the following URL (working, try it!)

https://select-test.wp3.rbsworldpay.com/wcc/purchase?instId=151711&cartId=28524&currency=GBP&amount=1401.49&testMode=100&name=Tom%20Gul&address=24%20House%20Road\nSome Place\nCounty&postcode=TR33%20999&email=email@mail.com&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.


回答1:


Try using %0A in the URL, just like you've used %20 instead of the space character.




回答2:


Try to replace the \n with %0A just like you have spaces replaced with %20.




回答3:


Use %0A (URL encoding) instead of \n (C encoding).




回答4:


late to the party, but if anyone comes across this, javascript has a encodeURI method



来源:https://stackoverflow.com/questions/3871729/transmitting-newline-character-n

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!