Reputation: 4215
In PowerShell, how do unescape the unicode escaped strings?
$str1 = "http:\u002f\u002fgoogle.com\u002fsomething\u002ftest"
to
http://google.com/something/test
Upvotes: 3
Views: 2201
Reputation: 4215
The code to do this is:
[Regex]::Replace($str1, "\\[Uu]([0-9A-Fa-f]{4})",
{[char]::ToString([Convert]::ToInt32($args[0].Groups[1].Value, 16))} )
Upvotes: 8