On Windows system, Mathematica by default opens stream which will automatically transform any "\n" into "\r\n". But I want pure line feed. In this post, librik suggested using BinaryFormat->True in OpenWrite to explicitly control newline behaviour.
In this way,
tmp = OpenWrite[file, BinaryFormat -> True];
WriteString[tmp, "test", "\n", "test"];
Close[tmp]
will give correctly
in which, "LF" is line feed corresponding to "\n" or 10th ASCII character.
However, if I want write Chinese characters, this is not working. For example
tmp = OpenWrite[file, BinaryFormat -> True,
CharacterEncoding -> "UTF8"];
WriteString[tmp, "测试", "\n", "test"];
Close[tmp]
Even though, I set CharacterEncoding -> "UTF8", the result is
The words are gone!
So librik's solution needs some extension. How to control newline for outputing any string?

