line terminators
NonNull
non-null at use.startmail.com
Wed Sep 28 19:36:38 UTC 2022
Hello,
I notice that readln from std.stdio has '\n' as the default line
terminator. What about multiple line terminators in UTF-8 being
used in one input file, such as '\n', NEL, LS, PS? And in Windows
"\r\n" is a line terminator, and what if NEL, LS, PS exist in a
Windows UTF-8 text file as well?
The following explains the details when reading Unicode.
https://en.wikipedia.org/wiki/Newline#Unicode
If I want to read a text file line by line, treating any one of
these things as a newline, there would seem to be no canned way
to do that in std.stdio .
1.) What is the best way to achieve this result in D?
It is convenient to read text files of unknown origin in this
fashion. Additionally discarding the newlines however they are
represented is convenient.
2.) What about reading UTF-16LE text files line by line (e.g.
from Windows, with a BOM)?
More information about the Digitalmars-d-learn
mailing list