×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

[WSH] How to properly run non English scripts in English Windows?

[WSH] How to properly run non English scripts in English Windows?

[WSH] How to properly run non English scripts in English Windows?

(OP)
For example, below simple `test.vbs` code displays some Cyrillic characters, but was encoded using ANSI encoding with Cyrillic code page 1251.

CODE

wscript.echo "БГДЖЗИЙ" 

The file's binary data:

CODE

77 73 63 72 69 70 74 2E 65 63 68 6F 20 22
C1 C3 C4 C6 C7 C8 C9
22 0D 0A 

In English Windows' Notepad, the code shows as:

CODE

wscript.echo "ÁÃÄÆÇÈÉ" 

When run with CSCRIPT from the command prompt, it'll displays the incorrect characters:

CODE

ÁÃÄÆÇÈÉ 

I've tried switching to code page 1251 using the CHCP command like below, but the result is the same. e.g.

CODE

chcp 1251
cscript test.vbs 

I also found out about the undocumented `//CP` command line switch to specify a code page, but it's not clear to which/what part(s) does that switch applies to. Anyone know?

Anyway... I've also tried using that switch like below, but still same result.

CODE

cscript //cp:1251 test.vbs 

And combine it with the `chcp` command. e.g.

CODE

chcp 1251
cscript //cp:1251 test.vbs 

I've also tried other Cyrillic code pages 21866 and 866, but same thing.

So, how to properly run the script so that it'll display the correct Cyrillic characters? Without changing the script file encoding to UTF16, or modifying it in any way.

RE: [WSH] How to properly run non English scripts in English Windows?

Use the unicode equivalents of the characters

CODE

letters = array(&H411, &H413, &H414, &H416, &H417, &H418, &H419)
cyrillic = ""
for i = lbound(letters) to ubound(letters)
    cyrillic = cyrillic & chrw(letters(i))
next
wscript.echo cyrillic 

RE: [WSH] How to properly run non English scripts in English Windows?

Alternatively, change the encoding of your original script to unicode (ucs2 LE) before saving it. You don't need to change the codepage. Change the font to Lucida Console.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close