Sign in Join

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

Mailing lists / fpc-pascal / 2009-09

Please Help with inifile in WinCE (ReadSectionValues into stringlist)

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

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

epergola

Hi
I have a small translation file (pure ASCII DOS text) written in Win32. I copied it to the emulator with Activesync.
The file contains one sections ('f') in this format [f]
'Language||idioma'. (etc.)
(i.e. the English test on the 1st half, the Spanish translation on the 2nd half)
In the WinCE test program run on the emulator, I read it this way:

IniFile := TIniFile.Create(s) ;

      tl:=TStringList.Create;
      try
        inifile.ReadSectionValues('f',tL);
        for i:=0 to tl.Count-1 do begin
           tl[i]:=ConvertEncoding(tl[i],GuessEncoding(tl[i]),EncodingAnsi);
           memo1.lines.add(tl[i]);

Now all works fine when the (2nd half) Spanish part has only english characters.
But when there are spanish special characters (accented A or O and similar) the tl[]
line is not written to assume the inifile in Wince is widestring UTF* encoded, so i tried to convert it
to ansi encoding but AFTER the tl string list is already populated. Is this the problem?
If so, what should I ReadSectionValues into different form TStringList? If the problem is other, can anyone give me clue?
Thanks very much for any help

View this message in context: http://www.nabble.com/Please-Help-with-inifile-in-WinCE-%28ReadSectionValues-into-stringlist%29-tp25411974p25411974.html Sent from the Free Pascal - General mailing list .
JoshyFun
to epergola

Hello FPC-Pascal,

Saturday, September 12, 2009, 8:30:02 AM, you wrote:

e> tl[i]:=ConvertEncoding(tl[i],GuessEncoding(tl[i]),EncodingAnsi); e> memo1.lines.add(tl[i]);
e> Now all works fine when the (2nd half) Spanish part has only english e> characters.
e> But when there are spanish special characters (accented A or O and similar) e> the tl[]
e> line is not written to think this is a Lazarus subject but:

tl[i]:=ConvertEncoding(tl[i],'iso88591','utf8');

Because the ini file has spanish text so the source encoding should be iso-8859-1 and target encoding should be UTF8 to be displayed in a memo box.

Best regards, JoshyFun