Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How can I have my Delphi 5 app able to let chinese characters be entered

Posted on 2002-05-31
6
Medium Priority
?
447 Views
Last Modified: 2007-12-19
Hi,

How can I have my Delphi 5 app able to support users entering Chinese characters and other "difficult" languages?

I have heard about that Unicode components may be needed but I don't know of a good replacement set of replacement components (TEdit, TMemo, TLabel, etc).  I don't want to rewrite my app to make it able to do this.

However, I found something on the Borland web site which suggests that Delphi 6 can do this:

http://community.borland.com/article/0,1410,28189,00.html

If Delphi 5 can't display asian characters, what use would be the IMEMode, IMEName and BiDiMode?

Have had a lot of trouble finding useful information about this on the Internet.

Help!

Thanks,
MP
0
Comment
Question by:mikepj
[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
6 Comments
 
LVL 22

Accepted Solution

by:
Mohammed Nasman earned 600 total points
ID: 7048427
0
 

Expert Comment

by:sunrains
ID: 7048629
intersted,too!
r u chinese?
which city ?
0
 
LVL 2

Author Comment

by:mikepj
ID: 7048852
Nope; not Chinese; we only speak English here!

Will look at the unicode address
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 1

Expert Comment

by:pnh73
ID: 9010400
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Accept answer from mnasman

Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
Paul (pnh73)
EE Cleanup Volunteer
0
 
LVL 1

Expert Comment

by:pnh73
ID: 9010967
Thank you for your response

Paul (pnh73)
EE Cleanup Volunteer
0
 
LVL 2

Author Comment

by:mikepj
ID: 14118198
for sure this works with delphi 5 and later.  probably from delphi 3 onwards.  it seems to work famously!  have tried it with chinese windows.  if you use a copy of windows that is not on its primary language, it doesn't behave quite right.  haven't found a solution to that yet.

// added this to each form's .pas file:
uses
  ...., uLanguage;

called the following sometime before form is shown:

    FormLanguageInit(self);

// add this .pas file to your project
unit uLanguage;

interface

uses
  windows, forms, sysutils, graphics;

procedure FormLanguageInit(frm:TForm);
procedure FrameLanguageInit(fra:TFrame);

implementation

type
 TLanguage = 0..$FFFF;

// delphi-supplied api call header is supposedly incorrect
function TranslateCharsetInfo(lpSrc: Pointer; var lpCs: TCharsetInfo; dwFlags: DWORD): BOOL; stdcall; external gdi32;

function CodePageFromLocale(Language: TLanguage): Integer;
var
  Buf: array[0..6] of Char;
begin
  GetLocaleInfo(Language, LOCALE_IDefaultAnsiCodePage, Buf, 6);
  Result:= StrToIntDef(Buf, GetACP);
end;

function CharSetFromLocale(Language: TLanguage): TFontCharSet;
var
  CP: Integer;
  CSI: TCharsetInfo;
begin
  CP:= CodePageFromLocale(Language);
  TranslateCharsetInfo(Pointer(CP), CSI, TCI_SRCCODEPAGE);
  Result:= CSI.ciCharset;
end;

procedure FormLanguageInit(frm:TForm);
begin
  frm.Font.Charset:=CharSetFromLocale(SysLocale.PriLangID);  
end;

procedure FrameLanguageInit(fra:TFrame);
begin
  fra.Font.Charset:=CharSetFromLocale(SysLocale.PriLangID);  end;

end.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

636 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