Author Posts

November 6, 2013 at 1:27 pm

the array like this :

$arrOrganizations=("×'ד","א×'");

for ($i=0; $i -lt $arrOrganizations.length; $i++) {
$arrOrganizations[$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?

November 7, 2013 at 11:53 am

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.

November 7, 2013 at 8:55 pm

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.

November 11, 2013 at 6:37 am

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

Console:

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

ISE:

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

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