PowerShell encoding fuckery

Hi,

I have a pretty big problem here and just don’t know where to start searching. The problem could be selfmade but i’m not really sure.

I wrote my script in Visual Studio Code on my local computer, which is set to the region “United States”, Regional format “English (Switzerland)” and en-US. This is the local computer:

$OutputEncoding IsSingleByte : True BodyName : us-ascii EncodingName : US-ASCII HeaderName : us-ascii WebName : us-ascii WindowsCodePage : 1252 IsBrowserDisplay : False IsBrowserSave : False IsMailNewsDisplay : True IsMailNewsSave : True EncoderFallback : System.Text.EncoderReplacementFallback DecoderFallback : System.Text.DecoderReplacementFallback IsReadOnly : True CodePage : 20127 

And this is the target system on which the script should be running:

$OutputEncoding IsSingleByte : True BodyName : iso-8859-1 EncodingName : Western European (Windows) HeaderName : Windows-1252 WebName : Windows-1252 WindowsCodePage : 1252 IsBrowserDisplay : True IsBrowserSave : True IsMailNewsDisplay : True IsMailNewsSave : True EncoderFallback : System.Text.EncoderReplacementFallback DecoderFallback : System.Text.DecoderReplacementFallback IsReadOnly : True CodePage : 1252 

The target System is set to Region “Switzerland”, Regional Format “German (Switzerland)” and de-CH.

Now just to illustrate my issue: Source system:

$replaceTable = @{"ß"="ss";"à"="a";"á"="a";"â"="a";"ã"="a";"ä"="a";"å"="a";"æ"="ae";"ç"="c";"è"="e";"é"="e";"ê"="e";"ë"="e";"ì"="i";"í"="i";"î"="i";"ï"="i";"ð"="d";"ñ"="n";"ò"="o";"ó"="o";"ô"="o";"õ"="o";"ö"="o";"ø"="o";"ù"="u";"ú"="u";"û"="u";"ü"="u";"ý"="y";"þ"="p";"ÿ"="y"} 

Target system: https://i.imgur.com/W35PQbM.png (sorry, can’t copy paste out of the VM Remote Console)

What do I have to do to run the script in the same encoding as my computer has?

submitted by /u/ChaschNoSchnell
[link] [comments]

Leave a Reply