?
Solved

VB Application GUI text box  will not accept Polish characters

Posted on 2003-02-19
5
Medium Priority
?
1,100 Views
Last Modified: 2013-12-03
I am working with an application whose user interface is written in VB. If I wish to input a new record that happens to contain Polish chatacters, it will not accept them into the blank field - but instead converts them to 'normal' text for e.g the Polish character that looks like an L with a line through it now becomes a regular L - this is even before anything is committed to the underlying database - so the problem has nothing to do with the database support for Polish character sets.
Is it the case that the Application in question has a default font that does not support Polish characters, and would the vendor need to reconfigure the default font to permit Polish characters to be types into the text boxes?
Thanks,
Fergal
0
Comment
Question by:FergCollins
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
5 Comments
 
LVL 3

Expert Comment

by:VBtom
ID: 7980648
I had a similar problem before.
You can download free polish fonts (polskiestrony, arial CE etc) from http://hermes.umcs.lublin.pl/users/kosmulsk/michal/fonts.htm
Set a polish font for your textbox and your problem should be solved.
0
 
LVL 3

Expert Comment

by:VBtom
ID: 7985926
Did using a polish font solve your problem? If it doesn't, it should be a unicode to ansi problem. If so, put a comment here, then i can explain you how to get through this.
0
 

Author Comment

by:FergCollins
ID: 7993301
Thanks Tom,
I cannot see the VB behind the application I am working with so cannot edit the font type used - however, I have been told that the font type it uses always defaults to the underlying Operating System default font (In this case WinNT).

In this case, the vgafix.fon (a hidden file in the Windows directory) is the default font for the Operating System. It is this file that may need to be replaced with one that can support Polish Text. Have you encountered the vgafix.fon before?

Give me your final thoughts and I will mark the answer you gave me as accepted. Once again, I appreciate your response!
0
 
LVL 3

Expert Comment

by:VBtom
ID: 8007341
Hi Ferg.

Hope it helped a little, thanks for the points.
If you can't access the vb code, I wish you success, but I'm afraid it will be hard since I guess the app should be patched some way for proper displaying of polish chars.

Vgafix.sys is the font FixedSys, used for the dos-prompt. You could set a different codepage for it (using autoexec.bat or msconfig.exe depending on the windows version) but I'm afraid that will only influence the characters for the dos-prompt and dos-apps, not apps for windows.

The default font for a vb texbox (if the programmer doesn't select another font), is sserife.fon or MS Sans Serif, so if you're sure it's used for the textbox, maybe you could try something with that (PolskieStrony is very similar so probably it might be used to replace this.) But first read further cause the problem might be more complex than this.

I looked back at the app I once made where polish text had to go from excel (which uses unicode) to a VB textbox, I think what I found out might help you or at least make you understand what the problem is about.

Many modern applications use unicode (2 byte-characters, so nrs over 255 possible) for text. Then characters that don't belong to the standard ANSI-set, like the special polish characters, are given numbers over 255.
In unicode, no special font is needed for polish characters, normal Arial or Courier or ... will do (though probably the windows-component "support for central-european languages" should be installed for proper displaying and printing).
In VB it's no problem working with unicode strings (with the functions AscW, ChrW$,  ...).

But, textboxes (and the other intrinsic VB controls) can only display the basic charsets (0..255); actually, I suspect it's DBCS but that makes no difference, this only means a zero byte is added to each character. To display polish characters in a VB textbox, it's necessary to set the font of the textbox to a special CE font, where 55 of the standard ANSI characters have been replaced with special polish characters. For example, character 179 is a "3" in normal fonts but a "l" with a line through in CE fonts. Without a CE font for the textbox, you'll see a 3, with a CE font you'll see the special l.

When the text in the textbox comes from a 1-byte-character source (like a textfile or an access97 database), setting the font for the textbox is enough to solve the problem.

But when the text comes from unicode, there's a second and bigger problem: all characters are converted to 1-byte using the default codepage of the system. So for a windows in english (or some other west-european language), this means that all characters are changed to similar looking standard ansi-characters, which means that all special polish characters will loose their accents, lines and so on. And once they're in the textbox, all unicode information is lost, it's no longer possible to reconstruct the polish character!!! Setting a polish font for the textbox alone won't solve the problem then.
I guess it should be possible to change the default codepage somewhere in the registry, so the conversion of polish characters will work alright (but if this will work, some accent-characters for french, spanish, portuguese, dutch, danish, ... will also be converted to polish chars).
I used the following workaround: I set a CE font for the textbox (to be able to display the polish chars). I found out all numbers of polish chars in CE fonts, and all unicode numbers for the same characters; I give the complete list below, it might be useful for whatever patch you may make are have made for you.Then all strings that had to go from excel (unicode) to the textbox or from the textbox to excel, I passed through two functions I made: UnicodeToCE and CEToUnicode. In this functions, I examined the string char by char, if it contains polish chars, there are replaced to the char with the correct number (1byte- or unicode depending of the direction).

I wish you success. Here's the complete list of polish characters, and 2 small test you can use for testing support of polish characters.
---
Numbers of all polish charcters in CE fonts and unicode:
CE-Font      Unicode            CE-Font      Unicode
140      346            204      282
141      356            207      270
142      381            208      272
143      377            209      323
156      347            210      327
157      357            213      336
158      382            216      344
159      378            217      366
161      711            219      368
162      728            222      354
163      321            224      341
165      260            227      259
170      350            229      314
175      379            230      263
178      731            232      269
179      322            234      281
185      261            236      283
186      351            239      271
188      317            240      273
189      733            241      324
190      318            242      328
191      380            245      337
192      340            248      345
195      258            249      367
197      313            251      369
198      262            254      355
200      268            255      729
202      280
---
Test for polish characters in a VB textbox (1-byte): Make a new VB project with a wide textbox on the form. Set a CE font for the textbox. Paste this code. Then run and you should see the polish characters in the textbox:

Private Sub Form_Load()
Const TestString = "&#338;&#381;&#339;&#382;&#376;!"#%*/239:<=>?@CEFHJLOPQRUXY[^`cefhjlopqruxy{~"
Text1.Text = TestString
End Sub
---
Test for polish characters in unicode.
Copy the following to the clipboard. Start ms word, press Alt-F11, then Ctrl-G, then Ctrl-V. Put the cursor at the end (after "729))" and press enter. Press Alt-F11 again and you should see the polish characters in the word-doc.

Activedocument.Content = ( _
ChrW$(346) & ChrW$(356) & ChrW$(381) & ChrW$(377) & ChrW$(347) & _
ChrW$(357) & ChrW$(382) & ChrW$(378) & ChrW$(711) & ChrW$(728) & _
ChrW$(321) & ChrW$(260) & ChrW$(350) & ChrW$(379) & ChrW$(731) & _
ChrW$(322) & ChrW$(261) & ChrW$(351) & ChrW$(317) & ChrW$(733) & _
ChrW$(318) & ChrW$(380) & ChrW$(340) & ChrW$(258) & ChrW$(313) & _
ChrW$(262) & ChrW$(268) & ChrW$(280) & ChrW$(282) & ChrW$(270) & _
ChrW$(272) & ChrW$(323) & ChrW$(327) & ChrW$(336) & ChrW$(344) & _
ChrW$(366) & ChrW$(368) & ChrW$(354) & ChrW$(341) & ChrW$(259) & _
ChrW$(314) & ChrW$(263) & ChrW$(269) & ChrW$(281) & ChrW$(283) & _
ChrW$(271) & ChrW$(273) & ChrW$(324) & ChrW$(328) & ChrW$(337) & _
ChrW$(345) & ChrW$(367) & ChrW$(369) & ChrW$(355) & ChrW$(729))
0
 
LVL 3

Accepted Solution

by:
VBtom earned 300 total points
ID: 8008914
Hi Ferg.
I hope my answer helped you.
Just a final remark for when you or anyone else want to try my VB textbox-test.
I saw that it didn't succeed to sent the teststring for that example correctly through the internet (just another illustration of these damned unicode conversion problems!). Use this instead for testing a VB textbox having a CE font:

Private Sub Form_Load()
Text1.Text = _
Chr$(140) & Chr$(141) & Chr$(142) & Chr$(143) & Chr$(156) & _
Chr$(157) & Chr$(158) & Chr$(159) & Chr$(161) & Chr$(162) & _
Chr$(163) & Chr$(165) & Chr$(170) & Chr$(175) & Chr$(178) & _
Chr$(179) & Chr$(185) & Chr$(186) & Chr$(188) & Chr$(189) & _
Chr$(190) & Chr$(191) & Chr$(192) & Chr$(195) & Chr$(197) & _
Chr$(198) & Chr$(200) & Chr$(202) & Chr$(204) & Chr$(207) & _
Chr$(208) & Chr$(209) & Chr$(210) & Chr$(213) & Chr$(216) & _
Chr$(217) & Chr$(219) & Chr$(222) & Chr$(224) & Chr$(227) & _
Chr$(229) & Chr$(230) & Chr$(232) & Chr$(234) & Chr$(236) & _
Chr$(239) & Chr$(240) & Chr$(241) & Chr$(242) & Chr$(245) & _
Chr$(248) & Chr$(249) & Chr$(251) & Chr$(254) & Chr$(255)
End Sub

Then the text in the textbox should begin and end with the following chars:
S with accent, T with a small v above, ..........., t with a comma under it, a high dot.
The word-doc in the unicode test should look just the same (but the text in word can't be copied correctly to the textbox or the other way, just try and you'll see what I mean).
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
This article will show how Aten was able to supply easy management and control for Artear's video walls and wide range display configurations of their newsroom.
Progress
Starting up a Project

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question