Solved

How to provide supports for far east?

Posted on 2001-07-30
38
283 Views
Last Modified: 2013-12-03
Hello!
    I'm making an editor, but it doesn't support far east characters. If a editor supports, any double-byte character in the editor can be normally displayed, and normally deleted (if not, pressing backspace will delete only a half of the character). How to do it?
    Thank you!
0
Comment
Question by:prefix
  • 20
  • 18
38 Comments
 
LVL 6

Expert Comment

by:MichaelS
ID: 6336792
It's compleatly not clear what are you trying to do :(
Can you provide more details about your implementation?
Which controls do you use, is it win32 app, MFC......

In any cases you can check MSDN, it has complete documentation about subj.
0
 
LVL 1

Author Comment

by:prefix
ID: 6337357
Hi MichaelS,

Many controls like TextBox are unable to display double byte characters if it was set with a English font(but it can display double-byte chars after setting a double-byte font, like Japanese font, Chinese font...), and many of the controls are unable to display normally even setting a double-byte font, like UltraEdit.

This is the problem. Controls doesn't not supports double-byte characters.

But, some editors supports, like EmEditor, EditPlus...Typing double-byte characters in them are the same as single-byte characters (All texts are up to snuff).
They can display double-byte characters event setting with a English font, which need to do is the operating supports(use a far east OS).

Do you know what I'm talking about? I need to let my editor display characters like EmEditor displays - No problems for a far east user to use.
0
 
LVL 6

Expert Comment

by:MichaelS
ID: 6343396
>Controls doesn't not supports double-byte characters

In my apps I used static, editbox and richedit controls and have no problems with DBS. Sure you have to select font which can do it.
0
 
LVL 1

Author Comment

by:prefix
ID: 6362359
Hello, MichaelS
    Sorry for the delay, my site was hacked so I have to re-build it first.
    I didn't mean the static, edit box or richedit controls. I mean a View. What do I need to do for a View to support DBS? What things do I need to precaution?
0
 
LVL 6

Expert Comment

by:MichaelS
ID: 6363725
>I mean a View

Sorry, what do you mean by view?
0
 
LVL 1

Author Comment

by:prefix
ID: 6367792
oh, sorry, "I mean a CView".
I didn't use CRichView as usual, I'm trying to write a view derived from CView. I have no ideas of counting characters, getting the width of a character, the length of a line, etc. Because one line of text might include some double-byte characters and some ascii characters, and many characters don't have the same width...
0
 
LVL 1

Author Comment

by:prefix
ID: 6367801
oh, and I don't know how to process the double-byte characters (delete, save and etc.).
0
 
LVL 6

Expert Comment

by:MichaelS
ID: 6367831
>I'm trying to write a view derived from CView

OK, that's clear, and do you have some problems with that? Did you tried how it works with DBS? As I know sould be no problems.
0
 
LVL 1

Author Comment

by:prefix
ID: 6377161
please wait, I'll make a screenshot for you.
0
 
LVL 1

Author Comment

by:prefix
ID: 6382651
Hi, MichaelS, have a look at this two pictures:
http://www.neocactus.com/nodbs.gif
http://www.neocactus.com/nodbsj.gif
0
 
LVL 6

Expert Comment

by:MichaelS
ID: 6383780
Ok, I did.
So looks like either you don't have right font or you don't use _MBCS in proprocessor definitions (in projects settings).
0
 
LVL 1

Author Comment

by:prefix
ID: 6400241
Oh, I'm sure I have right font.
And I've just tried use _MBCS in processor definitions. (but I'm not sure which...so I add it to both MIDL and c/c++) but nothing changed after a rebuild all.
And I don't know how to count the length of the whole line.

BTW: I'm using a Japanese OS, it has a Japanese input method. The input method can recognize whether the input window supports DBS, if the input window does not supports, it will display Japanese characters in its own window when inputting. So, I know the input window of my program does not support DBS.
0
 
LVL 6

Expert Comment

by:MichaelS
ID: 6400249
Hmmm. May be CView really doesn't supports DBS :(
can you do some tests, put edit control and check does it works in your project or not. Than we will know is the problem in CView or in project generally.
0
 
LVL 1

Author Comment

by:prefix
ID: 6400442
Hi MichaelS,
The edit control works fine with DBS.
I think CView doesnot supports DBS - To make it support is our work.
0
 
LVL 6

Expert Comment

by:MichaelS
ID: 6400447
:(
no luck with CView than
If your all sould work only under WinNT may be you can use UNICODE?
0
 
LVL 1

Author Comment

by:prefix
ID: 6400484
My program need to work under both NT and 98...
I've heard some programs support UNICODE, and they work fine under both NT and 98...ahh...EmEditor, do you know this editor?
Or may we transfer the problem to..."How to make a UNICODE program under NT and make it work fine under 98"?
Or other ideas???
0
 
LVL 6

Expert Comment

by:MichaelS
ID: 6400494
>How to make a UNICODE program under NT and make it work fine under 98

UNICODE programs works only under NT/2k, no 9x
I think you have to write your own CView class
0
 
LVL 1

Author Comment

by:prefix
ID: 6400509
So, we return to this question..
0
 
LVL 6

Expert Comment

by:MichaelS
ID: 6400537
From MSDN I found:

>MFC is fully enabled for writing applications that use Unicode? and multibyte character sets (MBCS), specifically double-byte character sets (DBCS).

So CView sould support it. Looks like we some some error in your setting or code. Can you show some code?
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 1

Author Comment

by:prefix
ID: 6413199
Hi, MichaelS:
I'm glad to show you the code but I'm just a beginner of VC, the code is complex for me, I don't know what I can show, so I express it in natural language...
I use a CArray to store the characters when we key in, the array store line by line, and use a bitmap to display the characters, I use textout to draw it to the bitmap and then copy it to the view....ouch, just only it...I think the problem is I use the CArray to store each character, so a double-byte character might be seperated...
Can you tell me what functions different from ansi functions to use if a app needs far east support?
0
 
LVL 6

Expert Comment

by:MichaelS
ID: 6413212
>Can you tell me what functions different from ansi functions to use if a app needs far east support?

it depends from which functions do you use. Can you show the code where you use TextOut and where you store lines in your array?
0
 
LVL 1

Author Comment

by:prefix
ID: 6413535
oh, It's hard to say, ok, leave your email, and I'll send my project to you, ok?
0
 
LVL 6

Expert Comment

by:MichaelS
ID: 6413960
you can find my e-mail in my profile
0
 
LVL 1

Author Comment

by:prefix
ID: 6444452
Hi, MichaelS, did you received my mail? Can you solve the problem?
0
 
LVL 6

Expert Comment

by:MichaelS
ID: 6444550
Hi, prefix, I have got your e-mail but wasn't able to open it correctly. Can you try it once more, I will reply on it and you will have my direct e-mail. You it.
0
 
LVL 1

Author Comment

by:prefix
ID: 6447005
Hi, the mail had been re-sent.
0
 
LVL 6

Expert Comment

by:MichaelS
ID: 6447584
Ok, now I got it. I am trying to figure out how it works.
0
 
LVL 6

Accepted Solution

by:
MichaelS earned 100 total points
ID: 6447665
You just have problems with fonts. I tested your code, modifyed it and it works. I created in InitInstance global object of CFont and than before your ExtTextOut I selected it. Than I can see right japanece characters on the screen.

I think you even have to use ChoosFont function to allow user select his another font.
0
 
LVL 1

Author Comment

by:prefix
ID: 6447781
Hi, MichaelS, please send the modified code to me.
0
 
LVL 1

Author Comment

by:prefix
ID: 6450664
Hi, I received your code, but it the problem still haven't been solved.
And the cursor position is still wrong. And when I press backspace key, it deletes a half of a double-byte character.
My problem is not only displaying, this program has several problems on double-byte characters.
0
 
LVL 6

Expert Comment

by:MichaelS
ID: 6450680
well, I afraid than just have no time to debug all your code and fix all the bugs, sorry.
0
 
LVL 1

Author Comment

by:prefix
ID: 6450807
ok, but can you tell me the way to modify my program supports dbs? How to store double-byte characters, how to prevent the separation of a double-byte characters, how to calcualte the right position of the cursor, and how let the system konw it is a double-byte-character compatible program?
Questions are too many, but I really no ideas of them. Thank you!
0
 
LVL 6

Expert Comment

by:MichaelS
ID: 6450817
>Questions are too many, but I really no ideas of them.

Read a book about it. I ordered one from amazon when I was need this info, there is a compleat book also in MSDN. Look for "globalization" and "localization" of software.
0
 
LVL 1

Author Comment

by:prefix
ID: 6455282
MichaelS, if MSDN and the books which I found can help me enough, than I didn't need to ask this question here.
0
 
LVL 6

Expert Comment

by:MichaelS
ID: 6455831
Ah, I see, you just need that someone correct your code, actually that someone 250 kb of your code.
0
 
LVL 1

Author Comment

by:prefix
ID: 6456015
No, Don't need to correct my code, but need tell me how to correct, not only tell me "there're some books about it, go and have some to read".
0
 
LVL 6

Expert Comment

by:MichaelS
ID: 6503147
prefix, what was that?
0
 
LVL 1

Author Comment

by:prefix
ID: 6503532
Oh, sorry, I think you said it's about the problem of the font is right, but you didn't give me help enough(I think), I think still leaving the question is not a good idea.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

708 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now