Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

View Poll Results: How was that ?
Good 1 25.00%
Nice 0 0%
Ummm, not bad 2 50.00%
boro binim baba delet khoshe 1 25.00%
Voters: 4. You may not vote on this poll

Reply
 
Thread Tools Display Modes
Old Sep 25th, 2005, 12:04 PM   #1
sma_soft
Newbie
 
Join Date: Sep 2005
Location: Iran
Posts: 2
Rep Power: 0 sma_soft is on a distinguished road
Send a message via MSN to sma_soft Send a message via Yahoo to sma_soft
Convert a string to unicode string

Hi dudes,
I want to convert a string variable to its Unicode equivalent.
I know that I should use the MultiByteToWideChar function to do that. But I get the same result. Here is an example of that:

function ToUnicodeString(s:string):string;
var p1Char;
pw1:array[0..1024]of WideChar;
nLen1,nLen2:integer;
begin
p1:=PChar(s);
nLen1:=Length(s);
nLen2:=nLen1 * 2;
MultiByteToWideChar(CP_ACP , MB_COMPOSITE , p1 , nLen2 , @pw1 , nLen2);
Result:=WideString(pw1);
end;


Is there anything wrong in the code above ?
Thanks for help from anyone.
sma_soft is offline   Reply With Quote
Old Sep 25th, 2005, 2:16 PM   #2
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
And the point of the poll is what?
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Nov 16th, 2005, 4:48 AM   #3
SittingDuck
Programmer
 
SittingDuck's Avatar
 
Join Date: Nov 2005
Location: Moseley, Birmingham, England, Earth
Posts: 51
Rep Power: 3 SittingDuck is on a distinguished road
var
A: String
B: WideString
begin
A := 'This is the string to convert.';
B := A;
end;
SittingDuck is offline   Reply With Quote
Old Nov 16th, 2005, 5:06 AM   #4
ivan
Professional Programmer
 
ivan's Avatar
 
Join Date: Sep 2005
Location: serbia & montenegro
Posts: 484
Rep Power: 4 ivan is on a distinguished road
First time here that I see a such poll....
ivan is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 12:35 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC