[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: |
Fri, 31 Mar 2023 09:12:43 -0400 (EDT) |
Follow-up Comment #37, bug #63930 (project octave):
I saved the following to `Test_encoding.m`:
disp('text mode - UTF-8')
fid = fopen('textmode_utf8.tst', 'wt', 'n', 'UTF-8');
fwrite(fid, 'ä');
fclose(fid);
fid = fopen('textmode_utf8.tst', 'rb');
fread(fid)
fclose(fid);
disp('binary mode - UTF-8')
fid = fopen('binarymode_utf8.tst', 'wb', 'n', 'UTF-8');
fwrite(fid, 'ä');
fclose(fid);
fid = fopen('binarymode_utf8.tst', 'rb');
fread(fid)
fclose(fid);
disp('text mode - Latin1')
fid = fopen('textmode_latin1.tst', 'wt', 'n', 'Latin1');
fwrite(fid, 'ä');
fclose(fid);
fid = fopen('textmode_latin1.tst', 'rb');
fread(fid)
fclose(fid);
disp('binary mode - Latin1')
fid = fopen('binarymode_latin1.tst', 'wb', 'n', 'Latin1');
fwrite(fid, 'ä');
fclose(fid);
fid = fopen('binarymode_latin1.tst', 'rb');
fread(fid)
fclose(fid);
Running it in Matlab R2022a resulted in the following:
>> Test_encoding
text mode - UTF-8
ans =
195
164
binary mode - UTF-8
ans =
195
164
text mode - Latin1
ans =
228
binary mode - Latin1
ans =
228
>>
So, Matlab seems to transcode strings independent on whether a file stream was
opened in text mode or in binary mode.
Should we revert https://hg.savannah.gnu.org/hgweb/octave/rev/fcd97a68e5f7 in
favor of a different change? At least, on the default branch?
We could keep that change to mitigate the effects of this issue on the stable
branch.
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?63930>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [Octave-bug-tracker] [bug #63930] fprintf problem, (continued)
- [Octave-bug-tracker] [bug #63930] fprintf problem, Arun Giridhar, 2023/03/24
- [Octave-bug-tracker] [bug #63930] fprintf problem, Dmitri A. Sergatskov, 2023/03/24
- [Octave-bug-tracker] [bug #63930] fprintf problem, Arun Giridhar, 2023/03/24
- [Octave-bug-tracker] [bug #63930] fprintf problem, Arun Giridhar, 2023/03/24
- [Octave-bug-tracker] [bug #63930] fprintf problem, Dmitri A. Sergatskov, 2023/03/24
- [Octave-bug-tracker] [bug #63930] fprintf problem, Markus Mützel, 2023/03/28
- [Octave-bug-tracker] [bug #63930] fprintf problem, Dmitri A. Sergatskov, 2023/03/28
- [Octave-bug-tracker] [bug #63930] fprintf problem, Markus Mützel, 2023/03/28
- [Octave-bug-tracker] [bug #63930] fprintf problem, Dmitri A. Sergatskov, 2023/03/28
- [Octave-bug-tracker] [bug #63930] fprintf problem, Markus Mützel, 2023/03/28
- [Octave-bug-tracker] [bug #63930] fprintf problem,
Markus Mützel <=
- [Octave-bug-tracker] [bug #63930] fprintf problem, Dmitri A. Sergatskov, 2023/03/31
- [Octave-bug-tracker] [bug #63930] fprintf problem, Markus Mützel, 2023/03/31
- [Octave-bug-tracker] [bug #63930] fprintf writes incorrect characters when converting the encoding, Markus Mützel, 2023/03/31