bugGNU Octave - Bugs: bug #65524, Editing text in the command window...


bug #65524: Editing text in the command window is unstable when non-ASCII characters are used

Submitter:  Charles Praplan <charprap>
Submitted:  Wed 27 Mar 2024 04:29:09 PM UTC
Category:  GUI Severity:  3 - Normal
Priority:  5 - Normal Item Group:  None
Status:  Confirmed Assigned to:  None
Originator Name:  Open/Closed:  * Open
Release:  * 9.1.0 Operating System:  * Microsoft Windows
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup

Fri 29 Mar 2024 08:20:46 AM UTC, comment #4: 

Thank you for pointing to this useful function: unicode_idx.

Charles Praplan <charprap>
Wed 27 Mar 2024 05:46:04 PM UTC, comment #3: 

I'm currently not working on the command window widget or anything UTF-8 related. But contributions are welcome.

Your question is a bit off-topic. And it would probably be better to ask those questions on the discourse forum:

Anyway. I agree it is a bit awkward. But you could use `unicode_idx` for those sorts of things when you know that you'll need to handle non-ASCII characters. E.g.:

str1 = '12345.03 cm, 12345.03 cm';
str2 = '12345.04 µm, 12345.03 µm';

str2(unicode_idx (str2) == 23)
str2(ismember (unicode_idx (str2), 23:24))

Markus Mützel <mmuetzel>
Group administrator
Wed 27 Mar 2024 05:35:23 PM UTC, comment #2: 

Great! I'm looking forward this improvement.

As you are working on the UTF-8 implementation, I mention here another small thing I saw, concerning indexing in strings.
I'm curious to here your opinion about this.

This problem is independent of the encoding !
Let's consider and execute the following code:

str1='12345.03 cm, 12345.03 cm';
str2='12345.04 µm, 12345.03 µm';


ans = 24
ans = 26

Although the two strings have the same length in terms of characters, Octave returns the length in terms of bytes.

Now if I want to get the 2nd occurence of the units (cm or µm) contained in the strings I have to select different start position but also different size, i.e. the size is dependent on the content and it is likely I have to decode UTF-8 myself to be able to isolate correctly a particular character.

str1(23 : 23 + 1)
str2(24 : 24 + 1)
str2(24 : 24 + 2)

ans = cm
ans = µ
ans = µm

Note that the same behaviour occurs in Matlab. However, due to the UTF-16 encoding this case occurs probabely very rarely, (not a problem for the above example).
An example of a Matlab string with a character coded with 2*16bits is given heraafter.

   test_str_for_ML=['1234', char(hex2dec('D834')), char(hex2dec('DD1E')),',7890']

Charles Praplan <charprap>
Wed 27 Mar 2024 04:56:35 PM UTC, comment #1: 

Support for UTF-8 on Windows is unfortunately still incomplete.
This will likely be fixed once the new experimental terminal widget is ready to be used by default.

Markus Mützel <mmuetzel>
Group administrator
Wed 27 Mar 2024 04:29:09 PM UTC, original submission:  

Editing text in the command window is unstable when special characters are used

This is independent on the encoding !

Type following things in the console and see what happens for each case

  A) disp('é')  then Enter                             -> Everything is ok

  B) disp('é')  then 4 time BS  then 'a')  then Enter  -> Observe the result

         >> disp('a')
         error: parse error:

           syntax error

         >>> disp(''a')        
         i.e. The executed code is not the code display in the prompt
  C) disp('é') then 4 time left arrow  then a  then Enter  -> Observe the result

         >> disp(aé')

         i.e.  aé is displayed although the command appearing in the console was invalid

     Then press up arrow and the previously executed command is displayed (different than what was displayed)

 etc. etc.

 - sometimes the display is also disabled as posted previously

Charles Praplan <charprap>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by mmuetzel (Posted a comment)
  • -email is unavailable- added by charprap (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.


    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2024-03-27 mmuetzel SummaryEditing text in the command window is unstable when special characters are used Editing text in the command window is unstable when non-ASCII characters are used
    2024-03-27 mmuetzel CategoryNone GUI
        StatusNone Confirmed

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code