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 Oct 5 '20 at 18:01
  • $\begingroup$ Look at test.txt in a hex editor and it should only contain a single byte 0x61. $\endgroup$ – flinty Oct 5 '20 at 18:02

To include an eol, try this:

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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