Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/69.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 防止\r\n转换为空格_C#_Html_Escaping - Fatal编程技术网

C# 防止\r\n转换为空格

C# 防止\r\n转换为空格,c#,html,escaping,C#,Html,Escaping,WriteEncodedText将所有\r\n替换为空格。如何防止这种情况发生?HTML无法按预期呈现\r\n。对于换行符,请使用br标记 请注意,根据,行仍应以\r\n结尾。请注意,您也不能将与WriteEncodedText一起使用,因为您将在输出中以br结尾。@JamesThorpe。。还有其他方法吗?如何在不使用html.decode的情况下将br转换为? htmlTextWriter.RenderBeginTag(HtmlTextWriterTag.P); htmlTextWriter

WriteEncodedText
将所有
\r\n
替换为空格。如何防止这种情况发生?

HTML无法按预期呈现
\r\n
。对于换行符,请使用
br
标记


请注意,根据,行仍应以
\r\n

结尾。请注意,您也不能将

WriteEncodedText
一起使用,因为您将在输出中以
br
结尾。@JamesThorpe。。还有其他方法吗?如何在不使用html.decode的情况下将br转换为
htmlTextWriter.RenderBeginTag(HtmlTextWriterTag.P);
htmlTextWriter.WriteEncodedText(text);
htmlTextWriter.RenderEndTag();