Not a direct answer to your question, but you can find it useful nonetheless. I have a tool that I wrote for processing PS and SQL scripts, but quickly discovered that people stick their emails, which screwed a ton of things. I had to do this to fix everything, and he should get everything:
if ($code.IndexOf([Char]0x2013) -gt -1) { $code = $code.Replace(([Char]0x2013).ToString(), "--") }
if ($code.IndexOf([Char]0x2014) -gt -1) { $code = $code.Replace(([Char]0x2014).ToString(), "-") }
if ($code.IndexOf([Char]0x2015) -gt -1) { $code = $code.Replace(([Char]0x2015).ToString(), "-") }
if ($code.IndexOf([Char]0x2017) -gt -1) { $code = $code.Replace(([Char]0x2017).ToString(), "_") }
if ($code.IndexOf([Char]0x2018) -gt -1) { $code = $code.Replace(([Char]0x2018).ToString(), "`'") }
if ($code.IndexOf([Char]0x2019) -gt -1) { $code = $code.Replace(([Char]0x2019).ToString(), "`'") }
if ($code.IndexOf([Char]0x201a) -gt -1) { $code = $code.Replace(([Char]0x201a).ToString(), ",") }
if ($code.IndexOf([Char]0x201b) -gt -1) { $code = $code.Replace(([Char]0x201b).ToString(), "`'") }
if ($code.IndexOf([Char]0x201c) -gt -1) { $code = $code.Replace(([Char]0x201c).ToString(), "`"") } # left double quotation mark
if ($code.IndexOf([Char]0x201d) -gt -1) { $code = $code.Replace(([Char]0x201d).ToString(), "`"") } # right double quotation mark
if ($code.IndexOf([Char]0x201e) -gt -1) { $code = $code.Replace(([Char]0x201e).ToString(), "`"") }
if ($code.IndexOf([Char]0x2026) -gt -1) { $code = $code.Replace(([Char]0x2026).ToString(), "...") }
if ($code.IndexOf([Char]0x2032) -gt -1) { $code = $code.Replace(([Char]0x2032).ToString(), "`"") } # prime
if ($code.IndexOf([Char]0x2033) -gt -1) { $code = $code.Replace(([Char]0x2033).ToString(), "`"") } # double prime
if ($code.IndexOf([Char]0x0009) -gt -1) { $code = $code.Replace(([Char]0x0009).ToString(), " ") } # tab
source
share