Load file in UTF

Hi

I try to import data into a tADVColumnGrid using this method :
G_Exemple.LoadFromCSV(L_Fichier.Text);

This file is a text file delimited by pipe "|" and it is encoded in UTF8.

The result of this importation is :
|Castelló d'Empúries||

whereas it sould be :
|Castelló d'Empúries||

How to get the right information ?

regards
olivier


No idea ? :(

SWAG, did you set the: AdvStringGrid1.Delimiter:='|';

yes, of course

Does the file have a byte order mark (BOM)?  If not, there is a LoadFromCSV overload which has an encoding parameter you can set, provided you have a Delphi version which supports Unicode.  

Thanks

You are right the BOM didn't exists, I added it and now it works ;)

olviier

Hello,


When i LoadFromCsv a file with a BOM (FF FE) in a TadvStringGrid the result is not correct 
I use Delphi 10.3 release 2
TadvStringGrid 8.4.8.1 (August 2019)
Do i have to define somewhere that i want to use unicode ?

Thanks

There is a parameter TEncoding in an overload of the grid.LoadFromCSV() method.
Specify the right encoding type with this TEncoding parameter.

thanks,

I saw that overloaded method but 
i didn't reach it because enclosed between {#IFDEF DELPHI_UNICODE}  in advgrid.pas
Where do i have to define that ?

    procedure LoadFromCSV(FileName: String; MaxRows: integer = -1; IgnoreRows: integer = -1); overload;
    {$IFDEF DELPHI_UNICODE}
    procedure LoadFromCSV(FileName: String; AEncoding: TEncoding; MaxRows: integer = -1; IgnoreRows: integer = -1); overload;
    {$ENDIF}

Sorry, stupid question

It works Fine
Thanks