漏洞?System.UriFormatException:无效的 URI:URI 方案无效

Col*_*acX 1 c# uri .net-core

字符串是相同的,但作为变量传递时它无效?

\n

这到底是怎么回事?这是语言错误吗?我在 C# .Net Core 中运行它

\n
var postUrl = "\xe2\x80\x8bhttp://www.contoso.com";\nvar postUri = new Uri("http://www.contoso.com"); // works\nvar uri = new Uri(postUrl); // does not work\n
Run Code Online (Sandbox Code Playgroud)\n

小智 8

如果你揪着你的头发,那是因为在 postUrl 中第一次打开引用后有空格。请删除该空间,您的错误就会消失。 在此输入图像描述