1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > Javascript解码#x格式的字符串

Javascript解码#x格式的字符串

时间:2019-06-06 08:08:07

相关推荐

Javascript解码#x格式的字符串

形如以下格式的字符串,中文是以&#x加四位十六进制数字的UTF-8编码:

System.Exception (0x80041FEC): 异常来自 HRESULT:0x80041FEC
 在 Microsoft.Internal.VisualStudio.Shell.Interop.IVsSolutionBuildOrderPrivate.GetBuildOrderList(Boolean fForceRecalculation, UInt32 cProjects, VsProjectBuildOrder[] pBuildOrder, UInt32& pValidationId)
 在 Microsoft.VisualStudio.ErrorListPkg.Shims.TaskListBase.RecalculateProjectRank()
 在 Microsoft.VisualStudio.ErrorListPkg.Shims.TaskListBase.OnEntriesChanged(Object sender, EntriesChangedEventArgs e)
 在 Microsoft.VisualStudio.Text.Utilities.GuardedOperations.RaiseEvent[TArgs](Object sender, EventHandler`1 eventHandlers, TArgs args)
--- 引发异常的上一位置中堆栈跟踪的末尾 ---
 在 Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)

以上字符可以通过以下两种方法解码:

1:

var encodeStr ='要解码的内容';var resultStr = eval('"' + encodeStr.replace(/&#x(.{4});/g,"\\u$1") + '"');

2:

var encodeStr ='要解码的内容';var resultStr = unescape(encodeStr.replace(/&#x(.{4});/g,"%u\$1"));

另外,站长之家也有提供解码工具,地址是:/tools/utf-8.aspx,进入之后将编码内容粘贴到右边的文本框里,单击“UTF-8转中文”按钮即可得到解码后的内容。

上面那段文字解码后为:

System.Exception (0x80041FEC): 异常来自 HRESULT:0x80041FEC

在 Microsoft.Internal.VisualStudio.Shell.Interop.IVsSolutionBuildOrderPrivate.GetBuildOrderList(Boolean fForceRecalculation, UInt32 cProjects, VsProjectBuildOrder[] pBuildOrder, UInt32& pValidationId)

在 Microsoft.VisualStudio.ErrorListPkg.Shims.TaskListBase.RecalculateProjectRank()

在 Microsoft.VisualStudio.ErrorListPkg.Shims.TaskListBase.OnEntriesChanged(Object sender, EntriesChangedEventArgs e)

在 Microsoft.VisualStudio.Text.Utilities.GuardedOperations.RaiseEvent[TArgs](Object sender, EventHandler`1 eventHandlers, TArgs args)

--- 引发异常的上一位置中堆栈跟踪的末尾 ---

在 Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。