bugGNU Octave - Bugs: bug #56072, @documentencoding UTF-8 tag should...


bug #56072: @documentencoding UTF-8 tag should override __mfile_encoding__

Submitter:  Colin Macdonald <cbm>
Submitted:  Thu 04 Apr 2019 07:10:23 AM UTC
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Feature Request
Status:  None Assigned to:  None
Originator Name:  Open/Closed:  * Open
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup

Thu 04 Apr 2019 08:14:26 AM UTC, comment #1: 

Oops that may not be 100% accurate: I think the utf-8 texinfo source does get mangled.  Perhaps I should said "both texinfo and m-file" should respect `@documentencoding UTF-8`, overriding `__mfile_encoding__`.

Colin Macdonald <cbm>
Thu 04 Apr 2019 07:10:23 AM UTC, original submission:  

There was a thread about _mfile_encoding_.  I didn't follow the whole thing but I think the gist was that it was something that would come from the host system.

There is at least one case where we know for sure: if the texinfo in the file specifies `@documentencoding UTF-8`.

Thus we should override `__mfile_encoding__` on a file-by-file basis if there is an explicit `@documentencoding` tag.

In Symbolic, the texinfo is full of UTF-8 unicode chars.  This is starting to work on Windows, as is the unicode-rendered math.  Funnily enough, one thing that doesn't work is the "1×2 matrix" in:

>> [sin(a/2) pi]
ans = (sym 1×2 matrix)

  ⎡   ⎛a⎞   ⎤
  ⎢sin⎜─⎟  π⎥
  ⎣   ⎝2⎠   ⎦

(On Windows, one gets something like "$\tilde{A}--$".
This is because this string is directly written in the @sym/display.m file:

 function [s1 s2] = sym_describe(x, unicode_dec)
   if (unicode_dec)
-    timesstr = '×';

And is thus interpreted by whatever lies _mfile_encoding_ chooses today/on this OS/with this moon phase.  But this is crazy because we just pulled utf-8 texinfo from the top of the very same file...

I plan to workaround this by not having any non-ascii chars in my code:
Although this still leaves `!%` BISTs.

Colin Macdonald <cbm>


(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 cbm (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.


    No changes have been made to this item

    Back to the top

    Powered by Savane 3.13-7b9d.
    Corresponding source code