Home > database >  Change Unicode to UTF-8 | PowerShell script
Change Unicode to UTF-8 | PowerShell script

Time:12-10

When I use Write-Host in my PowerShell script, the output looks like this: ????? ?????.

This happens because I'm entering strings in Arabic with Write-Host, and it seems that PowerShell doesn't support Arabic...

How do I print text using Write-Host, but in unicode UTF-8 (which supports Arabic).

Example: Write-Host "مرحباً بالعالم" The output in this case will be: ????? ?????

Any solutions?

CodePudding user response:

Fixed

You need to set a font that supports those characters. Like enter image description here

Before

enter image description here

I didn't actually need wt here, I'd suggest it. windowsterminal is a modern term, which is now an inbox app. Meaning it's default on windows going forward.

enter image description here

There's utf8 that doesn't work on the term, that wt supports (both using the cascadia code pl font

  • Related