[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #63931] Binary fwrite writes incorrect data to
From: |
Markus Mützel |
Subject: |
[Octave-bug-tracker] [bug #63931] Binary fwrite writes incorrect data to file |
Date: |
Sat, 1 Apr 2023 12:40:01 -0400 (EDT) |
Update of bug #63931 (project octave):
Status: Ready For Test => Patch Submitted
_______________________________________________________
Follow-up Comment #56:
The attached patch never uses the output stream with the encoding facet when
writing bytes even if an encoding (differing from UTF-8) is selected when
opening the output stream with `fopen`.
With it, the following modified version of the reproducer from comment #0
writes the correct bytes for me (note the specified encoding for `fopen`):
val = hex2dec('a7');
a = ones(2400,1)*val;
f = fopen('a.a','wb', 'n', 'Windows-1252');
fwrite(f,a,'uint8');
fclose(f);
f = fopen('a.a','rb');
b = fread(f,2400,'uint8');
fclose(f);
a(1)
b(1)
I did only very limited exploratory testing with this change.
Any feedback or test results are appreciated.
(file #54542)
_______________________________________________________
Additional Item Attachment:
File name: bug63931-do-not-convert-bytes.patch Size:1 KB
<https://file.savannah.gnu.org/file/bug63931-do-not-convert-bytes.patch?file_id=54542>
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?63931>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [Octave-bug-tracker] [bug #63931] Binary fwrite writes incorrect data to file, Markus Mützel, 2023/04/01
- [Octave-bug-tracker] [bug #63931] Binary fwrite writes incorrect data to file,
Markus Mützel <=
- [Octave-bug-tracker] [bug #63931] Binary fwrite writes incorrect data to file, Dmitri A. Sergatskov, 2023/04/01
- [Octave-bug-tracker] [bug #63931] Binary fwrite writes incorrect data to file, Henk Borsje, 2023/04/01
- [Octave-bug-tracker] [bug #63931] Binary fwrite writes incorrect data to file, Dmitri A. Sergatskov, 2023/04/01
- [Octave-bug-tracker] [bug #63931] Binary fwrite writes incorrect data to file, Dmitri A. Sergatskov, 2023/04/01
- [Octave-bug-tracker] [bug #63931] Binary fwrite writes incorrect data to file, Markus Mützel, 2023/04/02
- [Octave-bug-tracker] [bug #63931] Binary fwrite writes incorrect data to file, Markus Mützel, 2023/04/02
- [Octave-bug-tracker] [bug #63931] Binary fwrite writes incorrect data to file, Markus Mützel, 2023/04/07
- [Octave-bug-tracker] [bug #63931] Binary fwrite writes incorrect data to file, Charles Praplan, 2023/04/08
- [Octave-bug-tracker] [bug #63931] Binary fwrite writes incorrect data to file, Markus Mützel, 2023/04/08