C#等于javascript的unescape()是什么? [英] what is the c# equivalent to javascript's unescape()?

查看:49
本文介绍了C#等于javascript的unescape()是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试分析一些 JavaScript ,其中一行是

I am trying to analyse some JavaScript, and one line is

var x = unescape("%u4141%u4141 ......"); 

具有很多字符,格式为%uxxxx .

with lots of characters in form %uxxxx.

我想用 c#重写 JavaScript ,但是无法找出适当的函数来解码这样的字符串.我已经尝试过

I want to rewrite the JavaScript in c# but can't figure out the proper function to decode a string of characters like this. I've tried

HttpUtility.HTMLDecode("%u4141%u4141");

,但这根本没有改变这些字符.

but this did not change these characters at all.

如何在c#中完成此操作?

How can I accomplish this in c#?

推荐答案

您可以使用

已解码将包含䅁䅁" .

正如其他人指出的那样,将更改为 \ 是可以的,但是 UrlDecode 是首选方法,因为这样可以确保其他转义的符号也可以正确翻译.

As other have pointed out, changing the % to \ would work, but UrlDecode is the preferred method, since that ensures that other escaped symbols are translated correctly as well.

这篇关于C#等于javascript的unescape()是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆