Powershell not printing accented characters correctly
<p>So i'm trying to rename a file using powershell, the script should remove all special chars.</p>

<p>Simple right?  Not so fast.  Accented characters are not being parsed correctly</p>

<p>This is the script i'm using, called <code>renamefiles.ps1</code></p>

<pre><code>param([string]$complfn) #Must be the first statement in your script
</code></pre>

<p>Tried both of these without any difference, either using one of them or none</p>

<pre><code>#$OutputEncoding = [Console]::OutputEncoding
#[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
write-host $complfn

$encodage = New-Object System.Text.ASCIIEncoding 
[System.Console]::OutputEncoding = $encodage
Write-Host $complfn

$encodage = New-Object System.Text.utf8encoding 
[System.Console]::OutputEncoding = $encodage
Write-Host $complfn

$newcomplfn  = [Text.Encoding]::ASCII.GetString([Text.Encoding]::GetEncoding("Cyrillic").GetBytes($complfn))
Write-Host $newcomplfn
</code></pre>

<p>I'm using it like this
    <code>powershell.exe -file renamefiles.ps1 -complfn "ásdfésdf.txt"</code></p>

<p>This is the output i'm getting:</p>

<pre><code>Ã¡sdfÃ©sdf.txt
Ã¡sdfÃ©sdf.txt
Ã¡sdfÃ©sdf.txt
asdfesdf.txt
</code></pre>

<p>I see the last command is effectively replacing the accented characters, but do you know what can I use to display the orignal parameter (file name)?</p>