Skip to content

Commit ca98109

Browse files
committed
Add ISO8859-1 as fallback encoding when reading core file
Signed-off-by: Maxime Gervais <[email protected]>
1 parent 2471b40 commit ca98109

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Source/Common/Core.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1145,9 +1145,13 @@ int Core::Menu_File_Import_Core(const string &FileName)
11451145
//CSV
11461146
//Loading data in an array
11471147
string Sep=string(1, (char)Buffer[8]);
1148-
List.Separator_Set(1, Sep.c_str());
1149-
List.Write((const char*)Buffer);
1148+
Ztring ToWrite=Ztring().From_UTF8((const char*)Buffer);
1149+
if (ToWrite.empty())
1150+
ToWrite=Ztring().From_ISO_8859_1((const char*)Buffer); //Trying to read as plausible ISO-8859-1
1151+
11501152
delete[] Buffer; Buffer=NULL;
1153+
List.Separator_Set(1, Sep.c_str());
1154+
List.Write(ToWrite);
11511155
if (List.empty())
11521156
throw "--in-core=: not a valid file";
11531157
for (size_t Pos=0; Pos<List[0].size(); Pos++)

0 commit comments

Comments
 (0)