Board index » delphi » tstringlist.loadfromfile Unicode

tstringlist.loadfromfile Unicode

Hi, does anybody know how can
i load strings in a tstringlist.Loadfrofile
using a unicode text file?
Thank you.
 

Re:tstringlist.loadfromfile Unicode


Quote
Edierley Messias wrote:
> Hi, does anybody know how can
> i load strings in a tstringlist.Loadfrofile
> using a unicode text file?

Use TWideStringList:

http://www.delphi-unicode.net/Library.php

--
Rob

Re:tstringlist.loadfromfile Unicode


Hi Mr. Kennedy and everbody.

I already search and found the TWideStringList
before.
My problem is when I try to assign this TWideStringList
in components, it doesn't works. For example:

 Memo1: TMemo;
 tlist: TStringList;
 ws:= TWideStringList.Create;
 ws.LoadFromFile(fileUnicode);

 Memo1.Lines := ws;
 tlist:= ws;

Because (.Lines) is a TStrings class
and
Because (tlist) is a TStringList class
The error message is:
[Error] Unit2.pas(53): Incompatible types: 'TStringList' and 'TWideStringList'

Does anybody knows how can I assign a TWideStrinList in a TStringList????
Thanks for all.

--------------------------------------------------------------

Quote
Rob Kennedy <rkenn...@cs.wisc.edu> wrote in message <news:vb6lsosrop6j56@corp.supernews.com>...
> Edierley Messias wrote:
> > Hi, does anybody know how can
> > i load strings in a tstringlist.Loadfrofile
> > using a unicode text file?

> Use TWideStringList:

> http://www.delphi-unicode.net/Library.php

Re:tstringlist.loadfromfile Unicode


Quote
Edierley Messias wrote:
> My problem is when I try to assign this TWideStringList
> in components, it doesn't works. For example:

>  Memo1: TMemo;
>  tlist: TStringList;
>  ws:= TWideStringList.Create;
>  ws.LoadFromFile(fileUnicode);

>  Memo1.Lines := ws;
>  tlist:= ws;

> Because (.Lines) is a TStrings class

Memo1.Text := ws.Text;

The types are still different, but the compiler knows how to convert them.

Another option is for you to start using Unicode-enabled controls.

http://home.ccci.org/wolbrink/tnt/delphi_unicode_controls.htm

--
Rob

Other Threads