How to replace with br from querystring?

2019-06-11 09:04发布

Im trying to replace a %0A with a br to display linebreaks in a mail. Im sending a text from a textarea value as a querystring to an .asp page with javascript and I see the querystring sending word%0Anextword%0Anextword, but when I try to replace it in the .asp page, no replacement is done.

The querystring that is sent to the asp page from the javascript:

text=word%0Anextword

and I try to replace the querystring in the asp page like this:

texten=replace(request.querystring("texten"),"%0A","<br>")

I have tryed with HtmlEncoding, tryed to replace \n, \r\n etc, but nothing works? Any input really appriciated, thanks.

标签: replace
2条回答
三岁会撩人
2楼-- · 2019-06-11 09:35

Try this

replace(text,VbCrLf,"<br>")

A better solution may involve not reading the input from a querystring, change your form to POST and then use

message = Request.Form("text")
查看更多
乱世女痞
3楼-- · 2019-06-11 09:54

Use chr(10). In whatever language you need :)

查看更多
登录 后发表回答