RTF issue pasting from clipboard

This isn’t a bug, more just a problem in the way things are supposed to work. I do my research and organizing in Scrivener and most of my writing in Nota Bene; and often enough things I’ve written up as notes in NB (often long before I started using Scrivener) need to be copied and pasted into Scrivener as part of the organizing.

NB exports to the clipboard in RTF format. I find that when I try to paste such text into Scrivener, I have two options. (1) Ctrl+V imports full formatting, including indentation, fonts, italics, smart quotes, etc. Unfortunately, however, smart quotes and, for some reason, em dashes, do not appear as they should, but are represented by question marks in black diamonds. (2) Ctrl+Shift+V imports without formatting such as indentation, fonts, and italics; but smart quotes and em dashes, do appear properly. This remains true in v. 1.7.2. See the attached screenshot. Generally I use (2), since it’s easier to hunt through and fix a few italics than lots of smart quotes and em dashes.

This problem doesn’t happy with material copied and pasted from other programs, so obviously it’s NB’s bug and not Scrivener’s. I want to raise the issue with NB’s developers, but it would help me to do so if I knew exactly what Scrivener is doing when it pastes. I’d also be interested in knowing whether other users have such a problem with pasting from other software.

Many thanks for any thoughts.
Pasting into Scrivener.JPG

Let me update this slightly. I said this was Nota Bene’s bug, but I’m no longer quite sure about that.

If I copy from NB and paste into Word, WordPad, or other text editors, the formatting comes through fine. Scrivener is the only program that fails to reproduce smart quotes and em dashes. Moreover, if I save an NB file as .RTF and then import that RTF file into Scrivener, the same display problem with smart quotes and em dashes occurs; again, the problem does not occur in other text editors.

For some reason, then, there is some slight glitch in the RTF export/import function between just these two programs. (I also find that if I copy formatted text in Scrivener and paste it into NB, formatting such as italics or underlining is lost, though smart quotes are preserved.) I realize that the number of people who use both programs is quite small, and I don’t expect either set of developers to dig into what the other program is doing. But it would be helpful to me to have some technical information about how Scrivener handles importing RTF (from the clipboard and from files) to try to clear this up.

Hi David

The Wiki article for Rich Text Format describes some interoperability difficulties among the various dialects and implementations of RTF.

en.wikipedia.org/wiki/Rich_Text_Format

Have you considered pasting from NB into WordPad, then copying and pasting on into Scrivener? A similar approach is sometimes needed when pasting HTML in from browsers. The few extra keystrokes become second nature.

Rgds – Jerome

Thanks, Jerome. I may look through that article, but a quick glance suggests that I’ll need to get a better idea what I’m looking for first.

Yes, I can use WordPad or Word as a go-between (not quite the only thing I’d use Word for, but one of the few :slight_smile: ). Whether that’s more work than just hunting for the formatting problems depends on the amount of text involved, though.

A bit more information: another NB+Scrivener user reports that the same trouble, with question marks in black diamonds, occurs when pasting into Scrivener from Libre Office. So perhaps there is something that needs attention, though hardly urgent attention. Update: The other user reports that the current version of Libre Office does not have this problem. (Sorry for the yellow;this forum system doesn’t seem to have strikethrough.)

Scrivener is just taking the RTF content from the clipboard. The trouble here looks like whatever encoding NB is using for these characters is not interpreted as such in Scrivener’s stricter RTF handling.

Thanks, MM. It’s strange that even the relatively lowly WordPad can handle it OK. By “stricter” do you mean that Scrivener is doing less interpretive work on incoming RTF content than some other programs may be doing?

Update: The Nota Bene people tell me that NB saves standard “hi-bit” characters (such as smart quotes) in ANSI encoding, while Word saves them in Unicode. Could that be at the root of the difficulty?

Have you checked the Windows encoding used during import?

In TextPad, I fixed the problem you showed on the screen-shot by telling it to use UTF-8 encoding instead of the default (usually ISO 8859-1). The problem is that the characters that aren’t working are on a different Unicode codepage from the one your document is configured for, but have been encoded as if they are.

UTF-8 was invented to allow characters from different codepages to be mixed in the same 8-bit format. If you can change your Note Bene documents to use UTF-8, that might solve your problem.

Copying plain text, so your “Encoding for plain text” in Tools->Options is correct. And Scrivener’s RTF import will use the codepage declared in the clipboard “document”. So I don’t think its a Scrivener problem.

Scrivener’s export of RTF seems to use ANSI codepage 1252 (Look up Windows-1252 in Wikipedia to see the codes used.) but it does this correctly. (Characters not covered are represented as unicode e.g right-single-quote is \u8217).

Can you save the RTF paste in a separate file and inspect it in a plain-text editor like Notepad?
You might be able to see what Note Bene sent.

I checked that, and it only seems to apply to plain-text imports, not RTF. I tried System, UTF-8, and (at random) TSCII, with no effect.

Ah, OK. Sorry, I was trying something out and re-edited my previous post. Inspecting the pasted RTF “file” from the clipboard might show you what Note Bene is sending.

Excellent suggestion! I created another little test file in Nota Bene, copied the contents to the clipboard, and then (using ClipCache) saved the clip to a text file. For the benefit of any who can make anything out of it, I’ve attached it here, as “Pasting into Scrivener test clipboard.txt.”

For good measure, in Nota Bene I saved the test file as RTF, then renamed the RTF file to .TXT, so that the codes will display as text rather than being interpreted as formatting. It is also attached, as “Pasting into Scrivener test rtf file.txt.” The two files are not quite identical; the second one, I believe, contains more codes for page setup, as would naturally be needed for a saved RTF file as opposed to text just copied to the clipboard.

If anyone can analyze these files and tell me why they’d give Scrivener trouble with the smart quotes and the em dash, I’d be very much obliged indeed.
Pasting into Scrivener test clipboard.txt (1.52 KB)
Pasting into Scrivener test rtf file.txt (1.57 KB)