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

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

[Octave-bug-tracker] [bug #63930] fprintf problem


From: Markus Mützel
Subject: [Octave-bug-tracker] [bug #63930] fprintf problem
Date: Thu, 16 Mar 2023 09:33:03 -0400 (EDT)

Follow-up Comment #6, bug #63930 (project octave):

Thanks.

The encoding of the strings is actually converted twice.
1. When parsing the .m file, the entire file is converted from codepage 1252
to UTF-8. (That is done so that Octave can potentially feed those strings to
other libraries, like for regex matching or printing text in figures.)
2. When writing to the file, each character array is converted from UTF-8 to
the target encoding. That is either the one specified when opening the file
(with `fopen`), or, if none is specified, the encoding that is used for
parsing .m files (the encoding returned by `__mfile_encoding__`). That was
done to be compatible with Matlab.

I'm guessing that something might be going wrong in the second conversion if
the output is buffered, and the buffer is flushed when the end of it happens
to be "between" bytes of a multi-byte UTF-8 character...


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?63930>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

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