Group Abstract Group Abstract

Message Boards Message Boards

0
|
19 Views
|
2 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Copying text and pasting to an external file replaces some characters

Hi: when I copy some text from a notebook that has, say, a single right quotation symbol in it, if I paste into another notebook the 'curly' symbol remains (because under the hood it copies as \[CloseCurlyQuote], but if I paste it into an external text editor (after either a regular copy or a copy -> plain text) it gets replaced with a straight apostrophe.

Is this expected behavior, or a bug? If it is deliberate, what is the rationale? For me it causes problems because I am generating code to be pasted (as text) into my Jekyll site, and the apostrophes mean something, so I don't want curly quotes replaced by them when I do the copy and paste.

POSTED BY: Gareth Russell
2 Replies
Posted 18 hours ago

I'm not an expert, so maybe wait for others to jump in, but...

To solve your specific problem, I think you'll need to use Export rather than copy-paste.

To answer your question about whether this behavior is deliberate, I believe it is deliberate, yes. There may be some legacy stuff being carried over from a time before unicode was ubiquitous. I also think Mathematica is trying to be very careful about maintaining interpretability of its own representations, and so it does some coercions when copying to clipboard.

It's possible that there's an option to change this behavior, but I haven't found it.

POSTED BY: Eric Rimbey

You are right, exporting preserves the quotes. As there are just a couple in the text (at the moment, anyway), it's a mixed bag as to whether the time taken to generate another file, open it and copy that beats just fixing them by hand. But I was just surprised by the behavior — enough that it took me a while to figure out why my web page was broken! (If anyone is interested, the code generates text replacement rules that apply style formatting to a provided list of names with different classes, which generates this page.)

I'm still not quite sure why the copy-paste behavior would (should?) be different from the Export behavior, but as you say, maybe an insider will weigh in.

POSTED BY: Gareth Russell
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard