array with hebrew chars

the array like this :


for ($i=0; $i -lt $arrOrganizations.length; $i++) {

the result is :





instead of



only after setting setting the regional setting->administrative -> change system local to Hebrew(Israel)

i get the correct result, what can cause it?

The array is likely storing the characters individually rather than as pairs. Unfortunately, I don’t have access to a Hebrew-language system, so I can’t test this and confirm.

Are you seeing this problem in the ISE, or only at the PowerShell console? The console subsystem is a pain for this kind of thing; it has no Unicode support and very limited font selection. It sounds like you have the font covered, so you might be able to get away with adding this line at the beginning of your code:

[Console]::OutputEncoding = [Text.Encoding]::GetEncoding(1255)

Unfortunately, I don’t have a font that displays those characters properly, so I can’t really test it.

On a Win7 system running PS2 with Hebrew installed, but Non-Unicode set to English US:


PS C:\> $arrOrganizations=("??","??"); PS C:\> for ($i=0; $i -lt $arrOrganizations.length; $i++) {$arrOrganizations[$i]} ?? ??


PS C:\> $arrOrganizations=("אב","גד") for ($i=0; $i -lt $arrOrganizations.length; $i++) {$arrOrganizations[$i]} אב גד

Can you tell us what you’re running on/with?