Solved

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

Posted on 2002-05-31
6
441 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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
FMX enumerated colours 2 115
Show Listview image from database (String field) 5 135
Correct Component for Shopping Cart. 2 112
Print Graphic and Text to Epson TM-T88v 12 379
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

856 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