简体   繁体   English

C#将Unicode转义转换为字符串

[英]C# Convert a Unicode escaped to a string

I have a text such as "abc\57". 我有一个诸如“ abc \\ u001357”的文本。 It's a parameter in json object which I send from client to server via http. 这是json对象中的参数,我通过http从客户端将其发送到服务器。 How can I convert that text to a string like "abc%1357". 如何将文本转换为类似“ abc%1357”的字符串。 I tried with Regex to replace characters. 我尝试用正则表达式替换字符。 But it doesn't work 但这不起作用

Thanks for advance 谢谢前进

试试这个代码

var str = Uri.EscapeUriString("abc\u001357");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM