Log Message:
-----------
utf writing fix
Modified Files:
--------------
pgadmin3/src/ui:
frmQuery.cpp (r1.72 -> r1.73)
pgadmin3/src/utils:
misc.cpp (r1.51 -> r1.52)
Index: frmQuery.cpp
===================================================================
RCS file: /projects/pgadmin3/src/ui/frmQuery.cpp,v
retrieving revision 1.72
retrieving revision 1.73
diff -Lsrc/ui/frmQuery.cpp -Lsrc/ui/frmQuery.cpp -u -w -r1.72 -r1.73
--- src/ui/frmQuery.cpp
+++ src/ui/frmQuery.cpp
@@ -788,25 +788,12 @@
}
wxFileDialog dlg(this, _("Open query file"), lastDir, wxT(""),
- _("Query files (*.sql)|*.sql|UTF-8 query files (*.usql)|*.usql|All files
(*.*)|*.*"), wxOPEN);
-// _("Query files (*.sql)|*.sql|UTF-8 query files (*.usql)|*.usql|All files
(*.*)|*.*"), wxOPEN|wxHIDE_READONLY);
+ _("Query files (*.sql)|*.sql|All files (*.*)|*.*"), wxOPEN);
if (dlg.ShowModal() == wxID_OK)
{
lastFilename=dlg.GetFilename();
lastDir = dlg.GetDirectory();
lastPath = dlg.GetPath();
- switch (dlg.GetFilterIndex())
- {
- case 0:
- lastFileFormat = false;
- break;
- case 1:
- lastFileFormat = true;
- break;
- default:
- lastFileFormat = settings->GetUnicodeFile();
- break;
- }
openLastFile();
}
}
@@ -831,7 +818,7 @@
void frmQuery::OnSaveAs(wxCommandEvent& event)
{
wxFileDialog *dlg=new wxFileDialog(this, _("Save query file as"), lastDir,
lastFilename,
- _("Query files (*.sql)|*.sql|UTF-8 query files (*.usql)|*.usql|All files
(*.*)|*.*"), wxSAVE|wxOVERWRITE_PROMPT);
+ _("Query files (*.sql)|*.sql|UTF-8 query files (*.sql)|*.sql|All files
(*.*)|*.*"), wxSAVE|wxOVERWRITE_PROMPT);
if (dlg->ShowModal() == wxID_OK)
{
lastFilename=dlg->GetFilename();
Index: misc.cpp
===================================================================
RCS file: /projects/pgadmin3/src/utils/misc.cpp,v
retrieving revision 1.51
retrieving revision 1.52
diff -Lsrc/utils/misc.cpp -Lsrc/utils/misc.cpp -u -w -r1.51 -r1.52
--- src/utils/misc.cpp
+++ src/utils/misc.cpp
@@ -434,12 +434,17 @@
bool FileWrite(const wxString &filename, const wxString &data, int format)
{
- wxFontEncoding encoding;
- wxUtfFile file(filename);
+ wxFontEncoding encoding = wxFONTENCODING_DEFAULT;
+ wxUtfFile file;
if (format < 0)
{
+ if (wxFile::Access(filename, wxFile::read))
+ {
+ file.Open(filename);
encoding = file.GetEncoding();
+ file.Close();
+ }
if (encoding == wxFONTENCODING_DEFAULT)
encoding = settings->GetUnicodeFile() ? wxFONTENCODING_UTF8 :
wxFONTENCODING_SYSTEM;
}
@@ -447,7 +452,6 @@
encoding = format ? wxFONTENCODING_UTF8 : wxFONTENCODING_SYSTEM;
- file.Close();
file.Open(filename, wxFile::write, wxS_DEFAULT, encoding);
if (file.IsOpened())
---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match