Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to be able to display farsi unicode in vb6 textbox

Status
Not open for further replies.

rammi07

Programmer
Aug 1, 2006
20
NL
could any one show me how i can display farsi unicode letters in visual basic textbox. Now when i paste i get all ????????????????? instead of the sentence. Thanks
 
rjoubert
The article you refer to is talking about VB.NET - this question relates to VB6

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
 
strongm,

I set text box font to Arial, script Cyrilic. Then, from the language bar on my monitor, I selected "RU" (stands for Russian), and in VB code I typed some russian text. In VB code, the text looked encripted but when I ran the code, it indeed displayed the text in Russian correctly.

vladk
 
And moreover, I can type in Russian within VB6 text boxes during runtime; just switch the language at the language bar ...
 
And after selecting the right font at the Editor Format, VB code started display cyrilic correctly also.
 
I repeat: the VB6 textbox control is not Unicode-aware; none of the standard controls are. They only ship ANSI-aware versions.

Using code pages (which is what you are doing) is a different matter
 
I guess it might be worth pointing out that the Forms 2.0 controls that are used by VBA are Unicode-aware, so you could always use them (but see posts passim in this forum about the restrictions on redistribution, and how to legally deal with those restrictions)
 
strongm,

The thing I stress out is the possibility to implement the "language aware" textboxes in VB6 without resorting to non-standard or any non VB6 textboxes. I believe, this is what rammi07 is looking for. Your initial response might make think that this is impossible. But your information as always is very usefull.

vladk
 
Firstly, the OP specifically requested information on Farsi Unicode characters.

Secondly, the code page solution for supporting Arabic (CP 1256, which I believe requires that you install the Arabic language pack) does not actually have all the necessary characters for Farsi, so a proper Farsi solution requires Unicode
 
I don't have Farsi fonts and not an expert in Farsi like you... So I took other foreign language... I am not sure that Farsi is Arabic. Are you sure? Is it Iranian family language or not? I have an impression that this is rather Indo-European language, from Central Asian and Caspian regions.
 
Interesting stuff I found:

(Algorithm for representing Farsi characters)
(basic background on Farsi writing)
(program that translates many unicode sets into a form of ascii)
(a scholarly mini-tome on related subjects)
 
Vladk, I'd read the article again if I were you.

Bob, I'm not sure where you are taking us with your referenced articles.
 
Well, this is purely stuff that I found interesting that relates in some way to the problem at hand. I didn't mean to suggest that the reading represented any solution. The second article does point out that the Farsi alphabet isn't quite the same as the Arabic, having 32 characters rather than 28. The other ones have to do with others' attempts to analyze the problem or problems related in some way.
 
Fair enough, but those are mostly old articles. Arabic (and Farsi) support (via Unicode) is well established on the 32-bit Windows platforms. Just point your browser at say to see right-to-left Farsi rendered quite happily by your browser. Copy and paste some into Notepad or Word. Still should be OK.

But try and paste it into VB, and you'll get question marks simply because the controls do not support Unicode output - NOT because VB does not support Unicode or Arabic
 
Aha, yes I see your point. A random string from the joomla page renders quite happily, as you say, here, even reversing the arrow keys when you move the cursor in the string:
???? ????? ??? ???? ????? ?????? ?? ??? ??????? ?? ???? ?? ? ?????? ????? ??? ?? ??? ?? ????? ??

For the record, it also does so in word and wordpad, although not in notepad--just the little rectangles there. Also, just as you say, pasting into a text box just does question marks.

Hmm....works in wordpad...rich text...hmm...well, I tried pasting a string into a RichTextBox control on a VB form, and lo and behold, it works fine! So perhaps rammi07 can use that instead of a text box.

HTH

Bob
 
Hmm...well, it worked when I first pasted it into the edit box, and it worked when I previewed it, but now it doesn't work. Interesting. However, the rich textbox still works.

Bob
 
Can't imagine why I forgot that the RTB supports Unicode, but there it is.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top