In windows all works good but in android I got:
No mapping for the Unicode charset in the target multi-byte code page
How fix?
Thanks.
- Code: Select all
void __fastcall TForm1::Image1Click(TObject *Sender)
{
std::unique_ptr<TMemoryStream> WelcomeINI(new TMemoryStream());
try
{
IdHTTP1->Get(L"http://welcome.um.la/welcome.ini", WelcomeINI.get());
}
catch(Exception &E)
{
ShowMessage(L"Error.\n" + E.Message);
return;
}
WelcomeINI->Position = 0;
String path = "";
#ifdef __ANDROID__
path = System::Ioutils::TPath::Combine(System::Ioutils::TPath::GetTempPath(), L"welcome.ini");
#elif _Windows
path = System::Ioutils::TPath::Combine(System::Ioutils::TPath::GetTempPath(), L"welcome.ini");
#endif
try
{
WelcomeINI->SaveToFile(path);
}
catch(Exception &E)
{
ShowMessage(L"Error.\n" + E.Message);
return;
}
if(FileExists(path))
{
String SectionNAME = "";
std::unique_ptr<TIniFile> FileINI(new TIniFile(path));
std::unique_ptr<TStringList> AlliniSection(new TStringList());
FileINI->ReadSections(AlliniSection.get());
std::unique_ptr<TStringList> ValuesIniSection(new TStringList());
TListBoxItem *ListBoxItem;
TListBoxGroupHeader *ListBoxGroupHeader;
ListBox1->BeginUpdate();
for (int i = 0; i < AlliniSection->Count; i++)
{
SectionNAME = AlliniSection->Strings[i];
ListBoxGroupHeader = new TListBoxGroupHeader(ListBox1);
ListBoxGroupHeader->Text = SectionNAME;
ListBox1->AddObject(ListBoxGroupHeader);
FileINI->ReadSectionValues(SectionNAME, ValuesIniSection.get());
for (int j = 0; j < ValuesIniSection->Count; j++)
{
ListBoxItem = new TListBoxItem(ListBox1);
ListBoxItem->Text = ValuesIniSection->KeyNames[j];
ListBoxItem->StylesData["detail.visible"] = TValue::From<bool>(false);
ListBoxItem->ItemData->Detail = ValuesIniSection->ValueFromIndex[j];
//(aNone=0, aMore=1, aDetail=2, aCheckmark=3)
ListBoxItem->ItemData->Accessory = static_cast<TListBoxItemData::TAccessory>(1);
ListBox1->AddObject(ListBoxItem);
}
}
ListBox1->EndUpdate();
}
else
{
ShowMessage(L"No file");
}
}
If i save file welcome.ini in UTF-8 in android good but in Windows no. How fix code for android and windows?