Recent

Author Topic: [solved] TStringList - Unicode - Quick and Dirty / or Stream to prefer?  (Read 640 times)

Nicole

  • Hero Member
  • *****
  • Posts: 1303
My TStringList from Delphi loads fine with Delphi code, -  and shows questions marks with FreePascal.

This is not surprising and easy to be solved:
https://forum.lazarus.freepascal.org/index.php/topic,32496.msg209626.html#msg209626

This doing by code and run every loading again, - before I do this, I change then handful of unicode problem by hand.

My question is:
Is this a solution? Or will the StringList1.SaveToFile()   and .LoadToFile()
bring the problem back?

In other words: Is it better to save as stream?
« Last Edit: July 19, 2022, 05:38:05 pm by Nicole »

paweld

  • Hero Member
  • *****
  • Posts: 1560
Re: TStringList - Unicode - Quick and Dirty / or Stream to prefer?
« Reply #1 on: July 19, 2022, 05:19:18 pm »
Code: Pascal  [Select][+][-]
  1. StringList1.LoadFromFile('myfile.txt', TEncoding.UTF8); //or TEncoding.ANSI or TEncoding.SystemEncoding etc.
Best regards / Pozdrawiam
paweld

Nicole

  • Hero Member
  • *****
  • Posts: 1303
worked!
Thanks.

 

TinyPortal © 2005-2018