1

I have strange problem and minimal knowledge on VB6,

I got an EXE file that takes text (for button captions) from a text file.
This EXE which I don't has it code present all Hebrew text correctly.

I have build another EXE file (Identical to the previous) and all the functionally is working but it present all Hebrew as Gibberish!!

my text file encoding is Unicode.

Can you help me? Is there encoding for vb6 exe?

MarkJ
  • 30,070
  • 5
  • 68
  • 111
Dor Cohen
  • 16,769
  • 23
  • 93
  • 161
  • Related: [How can I get the charset VB6 is using?](http://stackoverflow.com/questions/6552310/how-can-i-get-the-charset-vb6-is-using), [VBA Output to file using UTF-16](http://stackoverflow.com/questions/9092548/vba-output-to-file-using-utf-16) – GSerg May 17 '12 at 11:14
  • Also related [what's the best option to display Unicode Hebrew etc in VB6](http://stackoverflow.com/questions/540361/whats-the-best-option-to-display-unicode-text-hebrew-etc-in-vb6) – MarkJ May 17 '12 at 14:59

2 Answers2

0

The default VB form/control fonts do not support all "foreign" characters.
If you set the font at runtime to "MS Shell Dlg" then Windows will translate this to the default UI font for that version of Windows which should handle most languages.

You'll also need to check the encoding of the file. If it's UTF-8 or a specific code page, then you'll need to use the MultibyteToWidechar() function to convert to UTF-16 for use in VB after reading it.

Deanna
  • 23,876
  • 7
  • 71
  • 156
  • +1. You also need to set your PC code page to Hebrew (Control Panel, regional settings, language for non-Unicode programs) – MarkJ May 17 '12 at 12:20
  • Thanks, but I didn't quit understand what you meant, what shell I write in my code that the Hebrew will be read correctly? my text file is Unicode. the other EXE working with the same file so the problem is in my EXE and not in the file or the PC environment – Dor Cohen May 17 '12 at 12:33
  • @MarkJ my PC code page is set to Hebrew, the other EXE working with the same file so the problem is in my EXE and not in the file or the PC environment – Dor Cohen May 17 '12 at 12:35
  • 1
    @DorCohen: Which unicode format? UTF-8? UTF-16? UTF-8 will require conversion, while UTF-16 will need a specific way of reading. As for displaying it, just set the control's font as I suggested. – Deanna May 17 '12 at 14:48
  • @Deanna Code page is very relevant for display. VB6 forms and controls can only display characters that are supported on the current code page. – MarkJ May 17 '12 at 14:57
  • @MarkJ: Oh yeah, it still needs the font setting correctly though. I've now deleted my comment saying otherwise :) – Deanna May 17 '12 at 16:23
  • @DorCohen: If this answer helped solve your problem, can you [accept the answer](http://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work) by clicking the green tick to the left of the post. If it didn't, can you provide more information on what you're trying to do and how the suggestion didn't work. – Deanna May 25 '12 at 14:05
0

the perfect solution to resolve this issue is to change the font.Charset to 177 that represent HEBREW_CHARSET.
For example:

Text1.Font.Charset = 177

http://www.example-code.com/vb/vb6-display-unicode.asp

Dor Cohen
  • 16,769
  • 23
  • 93
  • 161