I'm finding myself somewhat stumped on a simple problem. I'm trying to remove fancy quoting from a bunch of text files. I've the following script, where I'm trying a number of different replacement methods, but without results.
Here's an example that downloads the data from GitHub and attempts to convert.
$srcUrl="https://raw.github.com/gist/1129778/d4d899088ce7da19c12d822a711ab24e457c023f/gistfile1.txt"
$wc = New-Object net.WebClient
$wc.DownloadFile($srcUrl,"foo.txt")
$fancySingleQuotes = "[" + [string]::Join("",[char[]](0x2019, 0x2018)) + "]"
$c = Get-Content "foo.txt"
$c | % { `
$_ = $_.Replace("’","'")
$_ = $_.Replace("`“","`"")
$_.Replace("`”","`"")
} `
| Set-Content "foo2.txt"
What's the trick for this to work?