Hey, hope someone can give me some advice on a weird issue i’ve encountered.
I’m trying to send emails that contains swedish symbols using send-mailmessage in powershell 4.0. This works as intended when I run the command in a powershell console window but when I run the same cmdlet in a .ps1 file the swedish characters turn to gibberish.
Send-MailMessage -subject ‘Testing special characters: Å Ä Ö’ -Body ‘testing Å Ä Ö åäö’ -to $to -from $from -encoding UTF7 -smtpserver $smtpserver
The resulting mail when ran in ps1 file has the following body:
testing Ã…Ã„Ã– Ã¥Ã¤Ã¶
I then tried the .ps1 file on a win2008R2 server that has powershell 3.0 installed, and from this machine the email arrived correctly formatted.
Have I encountered a bug in PS 4.0 or am I missing something obvious here?