My PS script is sending email but changes the trademark and registered symbol to a question mark.
$body = "<b>A program™ has sent this email® . </b>"
Send-MailMessage -smtpServer mail -Subject "test" -BodyAsHtml $body
Output is A program? has sent this email? .
How can I get the symbols in the output email?
My PS script is sending email but changes the trademark and registered symbol to a question mark.
$body = "<b>A program™ has sent this email® . </b>"
Send-MailMessage -smtpServer mail -Subject "test" -BodyAsHtml $body
Output is A program? has sent this email? .
How can I get the symbols in the output email?
Share Improve this question asked Feb 17 at 10:22 Ko NayakiKo Nayaki 861 silver badge11 bronze badges 2 |1 Answer
Reset to default 3Easiest wasy to fix this: because you are sending a HTML body you can simply replace the symbols with ©
for © and ™
for ™.
-Encoding UTF8
toSend-MailMessage
– Mathias R. Jessen Commented Feb 17 at 10:25$Body
due to an unexpected terminal / console encoding. Try:$OutputEncoding = [console]::InputEncoding = [console]::OutputEncoding = New-Object System.Text.UTF8Encoding
first, see: Using UTF-8 Encoding (CHCP 65001) in Command Prompt / Windows Powershell (Windows 10) – iRon Commented Feb 17 at 10:32