简体   繁体   中英

Convert Utf8 to Unicode

I have a text file. I should convert it to Utf8. After converting, all the numbers in the file are converted to question marks. For example 1380 is converted to 4 question marks like this: '????'. I'm using delphi 2009.

This is my code for converting:

RichEdit1.Lines.LoadFromFile(OpenDialog1.FileName,TEncoding.UTF8);

How can i correct this conversion?

You should use TEncoding.Unicode if your file is in UTF-16LE ("Unicode") format. Or you should convert your file to UTF-8 before loading it into RichEdit.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM