mirror of
https://github.com/4ian/GDevelop.git
synced 2025-10-15 10:19:04 +00:00
@@ -127,7 +127,7 @@ InstancesAdvancedPasteDialog::InstancesAdvancedPasteDialog(wxWindow* parent,wxWi
|
||||
FlexGridSizer4 = new wxFlexGridSizer(0, 3, 0, 0);
|
||||
rotationEdit = new wxTextCtrl(this, ID_TEXTCTRL1, _("0"), wxDefaultPosition, wxSize(44,21), 0, wxDefaultValidator, _T("ID_TEXTCTRL1"));
|
||||
FlexGridSizer4->Add(rotationEdit, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
|
||||
StaticText5 = new wxStaticText(this, ID_STATICTEXT5, _("<EFBFBD>"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT5"));
|
||||
StaticText5 = new wxStaticText(this, ID_STATICTEXT5, _("deg"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT5"));
|
||||
FlexGridSizer4->Add(StaticText5, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
|
||||
FlexGridSizer3->Add(FlexGridSizer4, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0);
|
||||
StaticBoxSizer2->Add(FlexGridSizer3, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0);
|
||||
|
@@ -731,7 +731,7 @@ bool Project::LoadFromFile(const gd::String & filename)
|
||||
gd::SerializerElement rootElement;
|
||||
|
||||
//COMPATIBILITY CODE WITH ANSI GDEVELOP ( <= 3.6.83 )
|
||||
#if defined(GD_IDE_ONLY) //There should not be any problem with encoding in compiled games
|
||||
#if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI) //There should not be any problem with encoding in compiled games
|
||||
//Get the declaration element
|
||||
TiXmlDeclaration * declXmlElement = hdl.FirstChild().ToNode()->ToDeclaration();
|
||||
if(strcmp(declXmlElement->Encoding(), "UTF-8") != 0)
|
||||
@@ -767,18 +767,9 @@ bool Project::LoadFromFile(const gd::String & filename)
|
||||
std::cout << "The project file is not encoded in UTF8, conversion started... ";
|
||||
|
||||
//Create a temporary file
|
||||
#if !defined(GD_NO_WX_GUI)
|
||||
#if defined(WINDOWS)
|
||||
wxString tmpFileName = wxFileName::CreateTempFileName("");
|
||||
#else
|
||||
wxString tmpFileName = wxStandardPaths::Get().GetUserConfigDir() + "/gdevelop_converted_project";
|
||||
#endif
|
||||
#else
|
||||
std::string tmpFileName = filename.ToLocale() + ".utf8";
|
||||
#endif
|
||||
|
||||
#if defined(WINDOWS)
|
||||
#if defined(WINDOWS)
|
||||
//Convert using the current locale
|
||||
wxString tmpFileName = wxFileName::CreateTempFileName("");
|
||||
std::ofstream outStream;
|
||||
docStream.open(filename.ToLocale(), ios::in);
|
||||
|
||||
@@ -798,16 +789,19 @@ bool Project::LoadFromFile(const gd::String & filename)
|
||||
outStream.close();
|
||||
docStream.close();
|
||||
|
||||
#else //ON LINUX OR MAC OS X
|
||||
#else
|
||||
//Convert using iconv command tool
|
||||
std::cout << "Executing " << "iconv -f LATIN1 -t UTF-8 \"" + filename.ToLocale() + "\" -o \"" + tmpFileName + "\"" << std::endl;
|
||||
#if !defined(GD_NO_WX_GUI)
|
||||
wxExecute("iconv -f LATIN1 -t UTF-8 \"" + filename.ToLocale() + "\" -o \"" + tmpFileName + "\"", wxEXEC_BLOCK);
|
||||
#else
|
||||
std::string command = "iconv -f LATIN1 -t UTF-8 \"" + filename.ToLocale() + "\" -o \"" + std::string(tmpFileName) + "\"";
|
||||
system(command.c_str());
|
||||
#endif
|
||||
#endif
|
||||
wxString tmpFileName = wxStandardPaths::Get().GetUserConfigDir() + "/gdevelop_converted_project";
|
||||
gd::String iconvCall = gd::String("iconv -f LATIN1 -t UTF-8 \"") + filename.ToLocale() + "\" ";
|
||||
#if defined(MACOS)
|
||||
iconvCall += "> \"" + tmpFileName + "\"";
|
||||
#else
|
||||
iconvCall += "-o \"" + tmpFileName + "\"";
|
||||
#endif
|
||||
|
||||
std::cout << "Executing " << iconvCall << std::endl;
|
||||
system(iconvCall.c_str());
|
||||
#endif
|
||||
|
||||
//Reload the converted file, forcing UTF8 encoding as the XML header is false (still written ISO-8859-1)
|
||||
doc.LoadFile(std::string(tmpFileName).c_str(), TIXML_ENCODING_UTF8);
|
||||
|
Reference in New Issue
Block a user