2010-08-02 2 views
-1

STEP 1: I have a text file, which has the following contents in different languages, and i saved the file by encoding format as "Unicode".How to Display Multiple Language Characters in a Control

  1. Romanian: Pot să mănânc sticlă şi ea nu mă răneşte.
  2. Ukrainian Я могу есть стекло, и оно мне не повредит.
  3. Armenian: Կրնամ ապակի ուտել եւ ինծի անհանգիստ չըներ.
  4. Georgian: მინას ვჭამ და არა მტკივა.
  5. Hindi: मैं काँच खा सकता हूँ, मुझे उस से कोई पीडा नहीं होती.
  6. Hebrew (2): אני יכול לאכול זכוכית וזה לא מזיק לי.
  7. Yiddish (2): איך קען עסן גלאָז און עס טוט מיר נישט וויי.
  8. Japanese: 私 は ガ ラ ス を 食 べ ら れ ま す. そ れ は 私 を 傷 つ け ま せ ん.
  9. Thai: ฉัน กิน กระจก ได้ แต่ มัน ไม่ ทำให้ ฉัน เจ็บ

STEP 2: I have created a project in MFC, VC++ environment which supports Unicode (changed in project settings to support Unicode). The project has a text box control. I want to display the above contents from the file in the textbox control in the project.

But if i display it. It is either showing as ???????? or every charcter is displayed as "box kindof" things. even i used MultiByteToWideChar and WideCharToMultiByte for converting. but still the same.

Note: Even if i copy the text & paste it in textbox, it is showing as ??????. If we copy paste in visual studio editor (any .cpp or .h file), it can able to display properly.

Can u please suggest me for this.

+0

Which programming language, OS, development environment, ...? What have you done so far? Show us the relevant parts of your code. – Philipp

+0

Also, how are the characters being encoded in the file itself? Are they Ansi or Unicode? If they are not Unicode to begin with, then you have to first decode them to their Unicode equivilents before then putting them into the Control. Also, make sure the Control is using a Unicode font that is capable of displaying those characters. –

+0

Я сейчас правильно обновил вопрос. извините за предыдущий вопрос, который я не дал четкой спецификации. – user408524

ответ

1

Considering that your question is at least incomplete I will give you just a hint: you should not use MultiByteToWideChar or WideCharToMultiByte in your code at all. If you are building an true Unicode application and you are reading Unicode files you do not need to do any conversion at all.

Box kind-of characters - these indicates that the current font does not contain the glyphs you need.

Considering that you are very new to stackoverflow, please spend some time analyzing how you should put a proper question: title, content, example code and proper tags.

Do your homework before asking, if you do not invest enough time in your question people will not give you good responses and you may even get negative feedback.

+0

+1 - В наши дни я вижу много плохо продуманных вопросов, когда, как представляется, ни один из читателей не читал или не искал заранее. – chryss