Delphi and Kylix

Moderators: pritaeas
Number of threads: 7264
Number of posts: 19073

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Delphi and Russian/Greek characters? Posted by ljuba on 18 Oct 2006 at 7:51 AM
Hello,

I am creating program using Delphi 5 which reads text in one Memo field character by character and if find some special character in second memo I put html code for that character, so that text from second field will be used on Web. With English text if I want to replace 'd' or 'e' or whatever with some #3432 or similar - it works fine.

But with Russian/Greek/Swedish/... characters I have 2 problems.

1. In code if I want to define what character to replace with what code:

case Memo1.Text[counterX] of
'А': Memo2.Text := Memo2.Text + 'А';
'Б': Memo2.Text := Memo2.Text + 'Б';
'В': Memo2.Text := Memo2.Text + 'В';
...
else
Memo2.Text := Memo2.Text + Memo1.Text[counterX];
end;

In Delphi IDE i get like this:

case Memo1.Text[counterX] of
'?': Memo2.Text := Memo2.Text + 'А';
'?': Memo2.Text := Memo2.Text + 'Б';
'?': Memo2.Text := Memo2.Text + 'В';
...
else
Memo2.Text := Memo2.Text + Memo1.Text[counterX];
end;

So how I can write russian or any other non-latin character in source code in IDE?

2. When I run program, and if I select in Windows Russian keyboard - when I write in memo field - I am getting ? instead character. And in MS Word I am getting normal russian characters.

PS: Same problem I have with Greek/Swedish/Thai/... languages.

Can somebody suggest something how I can fix these problems? Thanks

Regards,

Aleksandar
Report
Re: Delphi and Russian/Greek characters? Posted by zibadian on 18 Oct 2006 at 7:56 AM
: Hello,
:
: I am creating program using Delphi 5 which reads text in one Memo field character by character and if find some special character in second memo I put html code for that character, so that text from second field will be used on Web. With English text if I want to replace 'd' or 'e' or whatever with some #3432 or similar - it works fine.
:
: But with Russian/Greek/Swedish/... characters I have 2 problems.
:
: 1. In code if I want to define what character to replace with what code:
:
: case Memo1.Text[counterX] of
: 'А': Memo2.Text := Memo2.Text + 'А';
: 'Б': Memo2.Text := Memo2.Text + 'Б';
: 'В': Memo2.Text := Memo2.Text + 'В';
: ...
: else
: Memo2.Text := Memo2.Text + Memo1.Text[counterX];
: end;
:
: In Delphi IDE i get like this:
:
: case Memo1.Text[counterX] of
: '?': Memo2.Text := Memo2.Text + 'А';
: '?': Memo2.Text := Memo2.Text + 'Б';
: '?': Memo2.Text := Memo2.Text + 'В';
: ...
: else
: Memo2.Text := Memo2.Text + Memo1.Text[counterX];
: end;
:
: So how I can write russian or any other non-latin character in source code in IDE?
:
: 2. When I run program, and if I select in Windows Russian keyboard - when I write in memo field - I am getting ? instead character. And in MS Word I am getting normal russian characters.
:
: PS: Same problem I have with Greek/Swedish/Thai/... languages.
:
: Can somebody suggest something how I can fix these problems? Thanks
:
: Regards,
:
: Aleksandar
:
Try changing the Font of the memo, especially the Charset property of the font. The default set is set to western characters only.
Report
Re: Delphi and Russian/Greek characters? Posted by ljuba on 18 Oct 2006 at 8:04 AM
This message was edited by ljuba at 2006-10-18 8:9:59

This message was edited by ljuba at 2006-10-18 8:8:52

: Try changing the Font of the memo, especially the Charset property of the font. The default set is set to western characters only.
:
Thanks.

I tried ... and if I change just for memo field - doesn't work. If I change that for whole form - it works ... so like that I can solve 2nd problem. But still exist problem how to write russian/... characters in source code ... te predefine in case condition what to do in what situation.

How to write differently following case:

case Memo1.Text[counterX] of
'А': Memo2.Text := Memo2.Text + 'А';
'Б': Memo2.Text := Memo2.Text + 'Б';
'В': Memo2.Text := Memo2.Text + 'В';
...
else
Memo2.Text := Memo2.Text + Memo1.Text[counterX];
end;

Even here I couldn't write A, B, V, ... in russian but you understood problem.
Report
Re: Delphi and Russian/Greek characters? Posted by ljuba on 18 Oct 2006 at 9:05 AM
How I can go character by character in Memo.text and compare by ascii value? Chr? ...

case Memo1.Text[counterX] of
'#1040;': Memo2.Text := Memo2.Text + 'А';
'Б': Memo2.Text := Memo2.Text + 'Б';
'В': Memo2.Text := Memo2.Text + 'В';
...
else
Memo2.Text := Memo2.Text + Memo1.Text[counterX];
end;

Thanks
Report
Re: Delphi and Russian/Greek characters? Posted by zibadian on 18 Oct 2006 at 10:24 AM
: How I can go character by character in Memo.text and compare by ascii value? Chr? ...
:
: case Memo1.Text[counterX] of
: '#1040;': Memo2.Text := Memo2.Text + 'А';
: 'Б': Memo2.Text := Memo2.Text + 'Б';
: 'В': Memo2.Text := Memo2.Text + 'В';
: ...
: else
: Memo2.Text := Memo2.Text + Memo1.Text[counterX];
: end;
:
: Thanks
:
In the source code, you can use the unicode codes: #65 for example is captical A. Thus #1040 is the first character of your case statement.
Note: The greek/chinese/russian/.. characters are not part of the ASCII set, but the unicode set. ASCII has only 127 characters. For more info: http://en.wikipedia.org/wiki/Unicode and http://en.wikipedia.org/wiki/Ascii.



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.