?
Solved

how to convert a string from UTF-8 to unicode?

Posted on 2003-03-16
7
Medium Priority
?
486 Views
Last Modified: 2010-04-04
how to convert a string from UTF-8 to unicode? like the operation in Ultraedit32:
File->Conversions->UTF8 to Unicode
0
Comment
Question by:ArcherHu
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 

Author Comment

by:ArcherHu
ID: 8149951
it's useful to convert data get form unicode database
0
 
LVL 17

Expert Comment

by:geobul
ID: 8149981
Hi,

Try this:

var
  ws: WideString;
begin
  ...
  ws := WideString(YourString);
  ...

Regards, Geo
0
 

Author Comment

by:ArcherHu
ID: 8150034
no effect
0
 
LVL 9

Accepted Solution

by:
mocarts earned 200 total points
ID: 8155563
var
  pw: PWideChar;
  p: PAnsiChar;
begin
  p := ...
  GetMem(pw, strlen(p)*2+1);
  try
    if MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, p, strlen(p), pw, strlen(p)*2+1) = 0 then
      raise Exception.Create('Conversion filed');
...
  finally
    freemem(pw);
  end;
end;
0
 

Expert Comment

by:CleanupPing
ID: 9316751
ArcherHu:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses
Course of the Month12 days, 10 hours left to enroll

777 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