Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2017-02

StringGrid & Accented characters

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Koenraad Lelong

Hi,

I need to bulk-create a number of accounts for some service. The data I get from an excel-file. Unfortunately, the user-names contain accents (e.g. é or è) which the service does not accept. So I'm trying to make a converter.
I thought of using a StringGrid to "LoadfromCSV", modify the cells and then save the grid to CSV again.
Unfortunatly, when I load the CSV, the StringGrid shows strange characters for the accented letters. Is a StringGrid capable of storing those accented letters ? If so, how could I change them to their plain equivalents ?

Any thoughts ? Thanks,

Koenraad.

Reply by email

Bart
to Koenraad Lelong
Koenraad Lelong wrote 5 lines
I thought of using a StringGrid to "LoadfromCSV", modify the cells and then save the grid to CSV again. Unfortunatly, when I load the CSV, the StringGrid shows strange characters for the accented letters. Is a StringGrid capable of storing those accented letters ?

Of course it is.
Notice that Lazarus defaults strings to be UTF8-encoded. Your file probably is not.
So you must change the encoding of the strings on the fly. And I'm afraid you will have to do so again when saving, because I guess also the file you are creating is expected to be in windows (cp1252) encoding.

Bart

Reply by email