Mercurial > jwe > octave
changeset 28123:f2789cae04f3 stable
Don't use "codecForLocale" to get encoding for locale charset.
* ligui/src/gui-preferences-ed.h,
libgui/src/qt-interpreter-events.cc (qt_interpreter_events::gui_preference_adjust),
libgui/src/resource-manager.cc (resource_manager::get_codecs),
libgui/src/m-editor/file-editor-tab.cc (file_editor_tab):
"codecForLocal" is overridden in octave-qobject.cc (base_qobject). Use
"octave_locale_charset_wrapper" instead to query the name of the encoding for
the locale charset.
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Fri, 21 Feb 2020 11:31:45 +0100 |
parents | 818bd5b42651 |
children | 74bc925ae235 |
files | libgui/src/gui-preferences-ed.h libgui/src/m-editor/file-editor-tab.cc libgui/src/qt-interpreter-events.cc libgui/src/resource-manager.cc |
diffstat | 4 files changed, 19 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/libgui/src/gui-preferences-ed.h Fri Feb 21 09:32:06 2020 +0100 +++ b/libgui/src/gui-preferences-ed.h Fri Feb 21 11:31:45 2020 +0100 @@ -31,6 +31,7 @@ #endif #include "gui-preferences.h" +#include "localcharset-wrapper.h" // Editor preferences @@ -232,7 +233,9 @@ const gui_pref ed_default_enc ("editor/default_encoding", - QVariant (QTextCodec::codecForLocale ()->name ().toUpper ().prepend ("SYSTEM (").append (")"))); + QVariant (QString ("SYSTEM (") + + QString (octave_locale_charset_wrapper ()).toUpper () + + QString (")"))); const gui_pref ed_create_new_file ("editor/create_new_file", QVariant (false));
--- a/libgui/src/m-editor/file-editor-tab.cc Fri Feb 21 09:32:06 2020 +0100 +++ b/libgui/src/m-editor/file-editor-tab.cc Fri Feb 21 11:31:45 2020 +0100 @@ -74,6 +74,7 @@ #include "cmd-edit.h" #include "file-ops.h" +#include "localcharset-wrapper.h" #include "uniconv-wrappers.h" #include "bp-table.h" @@ -266,7 +267,8 @@ // encoding, not updated with the settings QString locale_enc_name = - QTextCodec::codecForLocale ()->name ().toUpper ().prepend ("SYSTEM (").append (")"); + QString ("SYSTEM (") + + QString (octave_locale_charset_wrapper ()).toUpper () + QString (")"); m_encoding = settings->value (ed_default_enc.key, locale_enc_name).toString (); m_enc_indicator->setText (m_encoding); // no changes in encoding yet
--- a/libgui/src/qt-interpreter-events.cc Fri Feb 21 09:32:06 2020 +0100 +++ b/libgui/src/qt-interpreter-events.cc Fri Feb 21 11:31:45 2020 +0100 @@ -39,6 +39,7 @@ #include "octave-qobject.h" #include "qt-interpreter-events.h" +#include "localcharset-wrapper.h" #include "oct-env.h" #include "str-vec.h" @@ -631,7 +632,9 @@ if (adjusted_value == "SYSTEM") adjusted_value = - QTextCodec::codecForLocale ()->name ().toUpper ().prepend ("SYSTEM (").append (")"); + QString ("SYSTEM (") + + QString (octave_locale_charset_wrapper ()).toUpper () + + QString (")"); else if (re.indexIn (adjusted_value) > -1) { if (codecs.contains ("IBM" + re.cap (1)))
--- a/libgui/src/resource-manager.cc Fri Feb 21 09:32:06 2020 +0100 +++ b/libgui/src/resource-manager.cc Fri Feb 21 11:31:45 2020 +0100 @@ -51,6 +51,7 @@ #include "workspace-model.h" #include "file-ops.h" +#include "localcharset-wrapper.h" #include "oct-env.h" #include "defaults.h" @@ -401,8 +402,9 @@ } // Append SYSTEM - codecs->append (QTextCodec::codecForLocale ()->name ().toUpper ().prepend - ("SYSTEM (").append (")")); + codecs->append (QString ("SYSTEM (") + + QString (octave_locale_charset_wrapper ()).toUpper () + + QString (")")); // Clean up and sort list of codecs codecs->removeDuplicates (); @@ -420,7 +422,7 @@ QString enc = current; // Check for valid codec for the default. If this fails, "SYSTEM" (i.e. - // codecForLocale) will be chosen. + // locale_charset) will be chosen. // FIXME: The default is "SYSTEM" on all platforms. So can this fallback // logic be removed completely? bool default_exists = false; @@ -429,8 +431,9 @@ default_exists = true; QString default_enc = - QTextCodec::codecForLocale ()->name ().toUpper ().prepend - ("SYSTEM (").append (")"); + QString ("SYSTEM (") + + QString (octave_locale_charset_wrapper ()).toUpper () + QString (")"); + if (enc.isEmpty ()) { enc = m_settings->value (ed_default_enc).toString ();