Solved

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

Posted on 2002-05-31
6
439 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
6 Comments
 
LVL 22

Accepted Solution

by:
Mohammed Nasman earned 200 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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

803 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