Displaying characters on a windows form from another codepage

A

adiel_g

I am trying to display some data that I received into a form. The
form is in english. The data is in cyrillic (russian) which uses
codepage 1251. I am trying to change the button text to russian. For
example:

cmdCancel.Text = "Îòìåíèòü"

Those are garbage characters which I dont mind if they are in that
format in the code. But when the actual button is displayed on the
screen, I want the real cyrillic (russian) characters to be
displayed. This will be used to translate all the buttons on the page
to cyrillic (russian). My question is how do I change the form to
show characters in cyrillic (russian) without changing the codepage
for the entire computer?

To get an idea of what I am looking for, I would like to run some type
of command such as:

me.codepage = 1251 ' This command does not exit, just a sample of
what I am looking for.

to display the cyrillic (russian) characters for the entire form...

Thanks Before Hand,
Adiel
 
A

Armin Zingler

I am trying to display some data that I received into a form. The
form is in english. The data is in cyrillic (russian) which uses
codepage 1251. I am trying to change the button text to russian.
For example:

cmdCancel.Text = "Îòìåíèòü"

If I enter cyrillic characters in source code, they display fine on the
button. (using default font "Microsoft Sans Serif").

cmdCancel.Text = "ФЙ"

Where do you store the texts? Where do you read them from?

(Note that this posting is UTF-8 encoded)


Armin
 
C

Cor Ligthert[MVP]

My question is how do I change the form to
show characters in cyrillic (russian) without changing the codepage
for the entire computer?

In my idea you cannot. The characters are displayed by the OS, as that does
not has the codepages installed for that, what should it do then? (Be aware
that this is not so clear in Vista as it was in past).

Cor
 
H

Herfried K. Wagner [MVP]

I am trying to display some data that I received into a form. The
form is in english. The data is in cyrillic (russian) which uses
codepage 1251. I am trying to change the button text to russian. For
example:

cmdCancel.Text = "Îòìåíèòü"

Please do not multipost. I replied in the Windows Forms group.
 
A

adiel_g

I found out what the problem is. The file they sent me with the
russian characters to use was in "russian ANSI" (not sure if this is
what it is called). So when I opened the file and pasted the
characters in the button I got this:

cmdCancel.Text = "Îòìåíèòü"

Since the originating user that created the file has a different code
page in windows, the characters could not be read properly on my
system. I will have him sent me a file that is unicode format. That
file I should be able to read. Then I can place the characters
directly in the code as explained above:

cmdCancel.Text = "ФЙ" ' <- characters are already in the correct
format, they will display correctly.


I have learn this also:

1. If you are saving characters from another code page in your form
using vs2005, visual studio will automatically show a prompt asking if
you want to change the format of the source code file from ANSI to
UNICODE. (Of course you would answer yes to keep the russian
characters in the correct format in your source code)

Thanks Everyone,

Adiel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top