Newlines in file

if i use replaceWithText method to save a file from a TextEditor component, all the newline \n seem to be replace with \r\n . is this the correct behavior?

well yes, that’s done by OutputStream::writeText. If you need to write a really specific format, you should just write the file as binary data.