How to replace with br from querystring?

2019-06-11 09:44发布

问题:

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.

回答1:

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



回答2:

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")


标签: replace