0

We have a script with Arabic characters.

Input:

write-output "Testing Arabic language input"
$x=@"
كاتريونا الرمادي
"@
Write-output $x

Output:

####START####
Testing Arabic language input
كاتريونا الرمادي
####END####

This content is not displayed properly.

Any specific way to Encode, so that Arabic characters can be displayed. Issue exists for all non english characters.

JosefZ
  • 28,460
  • 5
  • 44
  • 83
  • See; [Using UTF-8 Encoding (CHCP 65001) in Command Prompt / Windows Powershell (Windows 10)](https://stackoverflow.com/a/57134096/1701026) – iRon Mar 28 '23 at 07:43
  • You need to use the correct FONT. Try : You can change the font that PowerShell uses by right-clicking the title bar and going to Properties or Default. There's a Font tab in the window that opens where you can select a font and its size. – jdweng Mar 28 '23 at 11:18
  • Make sure your ps1 script is saved using utf8 with BOM encoding – Santiago Squarzon Mar 28 '23 at 15:28
  • You face a [mojibake](https://en.wikipedia.org/wiki/Mojibake) case: ```[System.Text.Encoding]::GetEncoding( 1252).GetString( [System.Text.Encoding]::GetEncoding( 'UTF-8').GetBytes( 'كاتريونا الرمادي'))``` returns ```كاتريونا الرمادي```… *The same example in Python is universally intelligible*): `'كاتريونا الرمادي'.encode( 'utf-8').decode( 'cp1252')` returns `'كاتريونا الرمادي'`. – JosefZ Mar 28 '23 at 19:45

0 Answers0