I have recently updated Mathematica to 12.1. Whenever I export strings as text now, as in the following MWE:

    Export["test.txt", "a", "Text"]

a highlighted question mark appears at the very end of the underlying txt file:


Then I need to put extra effort to remove. How I can avoid this problem?

  • $\begingroup$ I suspect that you are opening in an editor that uses this convention to warn you of a missing eol. $\endgroup$
    – Alan
    Commented Oct 5, 2020 at 18:01
  • $\begingroup$ Look at test.txt in a hex editor and it should only contain a single byte 0x61. $\endgroup$
    – flinty
    Commented Oct 5, 2020 at 18:02

1 Answer 1


To include an eol, try this:

Export["test.txt", "a\n", "Text"]
  • $\begingroup$ That's it. It worked out! Thanks a lot! $\endgroup$
    – ogledala
    Commented Oct 5, 2020 at 18:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.