There are two different commands run in my PowerShell 7.3 within Windows Terminal.
Just run the
az devops user showcommand.az devops user show --user $UserPrincipalName -o jsonRun the same command with a
$(...).$(az devops user show --user $UserPrincipalName -o json)
It because my user info contains Chinese characters. The first command will be able to show correct Chinese characters. The seconds command will show garbled text on the screen.
With the same commands, if I run in my Windows PowerShell 5.1, it display the Chinese characters perfectly. Why?
What's the difference between these two commands? How to display the Chinese characters correctly on the screen when running the second command in PowerShell 7.3?
Edit
I tried to run this before run my second command. Then the output display Chinese characters correctly.
[Console]::OutputEncoding = [System.Text.Encoding]::GetEncoding('big5')
Is there any way I can force az command output using utf8 encoding?

