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

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

[Octave-bug-tracker] [bug #64139] fileread doesn't support 'encoding' ar


From: Markus Mützel
Subject: [Octave-bug-tracker] [bug #64139] fileread doesn't support 'encoding' argument
Date: Thu, 4 May 2023 07:09:03 -0400 (EDT)

Follow-up Comment #5, bug #64139 (project octave):


> What I'm looking for is ignoring any BOM, what would be the most robust way
to do so?

You'd probably need to strip the BOM manually.
E.g., in Octave:

ex_str = fileread('example.txt');
if (strncmp(a, char([239, 187, 191]), 3))
  ex_str(1:3) = [];
end


Or you could use an external tool to strip the BOM beforehand.
The usage of a BOM in an UTF-8 encoded file is questionable anyway. There is
no byte-order if the surrogates *are* bytes.
Alas, MS chose to add the BOM by default with many of their tools...


    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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