unescape unicode string powershell

时间:2013-08-26 18:06:05

标签: powershell unicode decode

在PowerShell中,unescape unicode如何转义字符串?

$str1 = "http:\u002f\u002fgoogle.com\u002fsomething\u002ftest"

http://google.com/something/test

1 个答案:

答案 0 :(得分:4)

执行此操作的代码是:

[Regex]::Replace($str1, "\\[Uu]([0-9A-Fa-f]{4})", 
         {[char]::ToString([Convert]::ToInt32($args[0].Groups[1].Value, 16))} )