Question

I have written some code:

MnemonicList := TStringList.Create();

{$IFDEF Android}
  IniPath := TPath.Combine(TPath.GetDocumentsPath, ADefaultLanguage + '.ini');  { Internal }
{$ENDIF}

{$IFDEF Win32}
  IniPath := TPath.Combine(ExtractFilePath(ParamStr(0)), 'Lang\' + ADefaultLanguage + '.ini');
{$ENDIF}

if FileExists(IniPath) then
begin
 MemIniFile := TMemIniFile.Create(IniPath);
 ShowMessage(IniPath);

 MemIniFile.ReadSections(MnemonicList);
 ShowMessage(IntToStr(MnemonicList.Count));
end;

The second ShowMessage() results with 4 when runs on Windows and 0 when runs on Android... File is populated correctly and FileExists(IniPath) gives True also on Android. I can open files on Android and Windows in editor as well. Are there any differences on TMemIniFile on Android?

Was it helpful?

Solution

There was a problem with INI file characters encoding. When I changed to UTF-8 w/o BOM it started to work.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top