Macintosh text file with invalid line breaks are created
Andre Pany via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Sep 27 23:52:51 PDT 2016
Hi,
following application creates a text file with strange content:
void writeTextFile(string filePath, string text)
{
import std.stdio: File;
auto f = File(filePath, "w");
f.write(text);
f.close();
}
void main()
{
import std.ascii: newline;
string s = "a=1"~newline~"b=2";
writeTextFile("./test.txt", s);
}
Notepad++ detects the file as macintosh UTF8 file.
The file has following content:
a=1CR
CRLF
b=2
Where the first CR comes from? Is this a bug?
dmd v2.071.2 on win10
Kind regards
André
More information about the Digitalmars-d-learn
mailing list