octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #49118] GUI editor cannot run file in folder n


From: Hartmut
Subject: [Octave-bug-tracker] [bug #49118] GUI editor cannot run file in folder name with umlaut
Date: Sun, 23 Oct 2016 13:01:46 +0000 (UTC)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:49.0) Gecko/20100101 Firefox/49.0

Follow-up Comment #25, bug #49118 (project octave):

I have searched the Qt documentation a bit. Those are my sources:
* For our GUI text encoding before cset 2fd4f1a3f4a8 (works only in qt4):
** http://doc.qt.io/qt-4.8/qtextcodec.html#setCodecForCStrings
** http://doc.qt.io/qt-4.8/qstring.html#toAscii

Returns an 8-bit representation of the string as a QByteArray.
If a codec has been set using QTextCodec::setCodecForCStrings(), it is used to
convert Unicode to 8-bit char; otherwise this function does the same as
toLatin1().
Note that, despite the name, this function does not necessarily return an
US-ASCII (ANSI X3.4-1986) string and its result may not be US-ASCII
compatible.


* For our GUI text encoding after cset 2fd4f1a3f4a8 (works in qt4 and qt5):
** http://doc.qt.io/qt-5/qtextcodec.html#setCodecForLocale
** http://doc.qt.io/qt-5/qstring.html#toLatin1

Returns a Latin-1 representation of the string as a QByteArray.
The returned byte array is undefined if the string contains non-Latin1
characters. Those characters may be suppressed or replaced with a question
mark.

** http://doc.qt.io/qt-5/qstring.html#toLocal8Bit

Returns the local 8-bit representation of the string as a QByteArray. The
returned byte array is undefined if the string contains characters not
supported by the local 8-bit encoding.
QTextCodec::codecForLocale() is used to perform the conversion from Unicode.
If the locale encoding could not be determined, this function does the same as
toLatin1().
If this string contains any characters that cannot be encoded in the locale,
the returned byte array is undefined. Those characters may be suppressed or
replaced by another.


If I understand this correctly, then our former combination like this

QTextCodec::setCodecForCStrings (QTextCodec::codecForName ("UTF-8"));
QByteArray text = _edit_area->text ().toAscii ();

was converting texts to a 8bit representation, according to the utf8
encoding.

Our new combination like this

QTextCodec::setCodecForLocale (QTextCodec::codecForName ("UTF-8"));
QByteArray text = _edit_area->text ().toLatin1 ();

is converting text to the latin1 8bit repesentation. This is not the same as
the previous behavior. (If no locale is set, then this is a good replacement
as mentioned in the qt4-qt5 transition document, but we had a locale set.)

Could the following be a better way to change the code to something that runs
under qt4 and qt5?

QTextCodec::setCodecForLocale (QTextCodec::codecForName ("UTF-8"));
QByteArray text = _edit_area->text ().toLocal8Bit ();


I would technically be able to prepare a new cset for this, but I am
hesitating to do such changes very deep in core Octave, because I have never
used the qt libraries before. The files that might need a change like this,
are Vt102Emulation.cpp, file-editor-tab.cc and workspace-model.cc.


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?49118>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]