persian characters

Please discuss general Delphi programming topics here.

persian characters

Postby sepehr » November 27th, 2007, 4:13 pm

hi folks,
i am looking for the easiest way showing persian characters in delphi
var
s:string
begin
s:='مهدي' ;
showmessage(S);
end;
would result ???? , how can i correct that?
i think it's because the default character set for my delphi application is
Ansi and since ansi doesn't have persian characters it can not typecast it correctly and it is converted to ?s , another thing is when i set "Languages for non Unicode Programs" in control panel of windows the problem is solved! and characters are shown properly,but i don't want to make the user do this for running my application,i think i should change the character encoding of my application to unicode ,but how can i do this?

ps:please correct me if i'm wrong with my statments ;)
--
thanks in advance
User avatar
sepehr
Active Member
Active Member
 
Posts: 23
Joined: October 4th, 2006, 6:38 am
Location: Karaj

Postby Kambiz » November 28th, 2007, 4:23 am

Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

Postby sepehr » November 30th, 2007, 10:37 am

thanks,no i have another problem! now the persian characters are stored in mysql database az question marks(?s) what should i do?

ps:my charset in mysql is set to utf8
User avatar
sepehr
Active Member
Active Member
 
Posts: 23
Joined: October 4th, 2006, 6:38 am
Location: Karaj

Postby Kambiz » November 30th, 2007, 5:07 pm

After opening the connection, execute:

Code: Select all
SET CHARACTER SET utf8
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

Postby Kambiz » November 30th, 2007, 5:09 pm

By the way, be sure to convert SQL commands containing extended characters using UTF8Encode function.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm


Return to Delphi Programming

Who is online

Users browsing this forum: No registered users and 17 guests

cron