lucasmazza / copy-as-rtf

A package to export highlighted code as RTF
Other
19 stars 14 forks source link

It copy a lot of strange characters #9

Open jcmadrigalg opened 9 years ago

jcmadrigalg commented 9 years ago

Hi, I tried to use this package, but it didn't work to me.

I try this sample:

#include <stdio.h>

void main(){
 //some sentence
}

But when I copy with the package, it paste this to me.

{\rtf1\ansi\uc0\deff0{\fonttbl{\f0\fmodern\fprq1\fcharset0 Monaco;}}{\colortbl;\red0\green0\blue0;\red78\green154\blue6;\red0\green0\blue207;\red143\green89\blue2;\red245\green121\blue0;\red32\green74\blue135;\red206\green92\blue0;\red248\green248\blue248;\red0\green160\blue0;\red52\green101\blue164;\red128\green0\blue128;\red164\green0\blue0;\red92\green53\blue204;\red239\green41\blue41;\red196\green160\blue0;\red0\green0\blue128;\red204\green0\blue0;}\f0 {\cf4\i #}{\cf4\i include <stdio.h>}{\cf4\i \par
}\par
{\cf6\b void} {\cf1 main}{\cf1\b (}{\cf1\b )}{\cf1\b \{}\par
 {\cf4\i //some sentence\par
}{\cf1\b \}}\par
}

I'm using:

Thanks a lot!

lucasmazza commented 9 years ago

@charlynet7 that's the RTF format of the code you copied - if you paste it somewhere that supports RTF (instead of a plain text editor or something like that) it should paste the code with the proper syntax highlight.

jcmadrigalg commented 9 years ago

Hi @lucasmazza , I actually paste it to Outlook or Word, and both support RTF, it work with the Notepad++ feature. And I do have the issue of #5 . Thanks.

laike9m commented 9 years ago

+1 Paste to evernote which is supposed to support rtf.

lucasmazza commented 9 years ago

I haven't replicated this issue so far, and I think it might be something very Windows specific. I don't have the right environment to test this out, so it would be very welcomed if someone else could track this down and fix it.

steak3 commented 8 years ago

+1 for me. Is it possible to re-open the issue?

tafkey commented 8 years ago

+1 - same bug here Arch Linux, LibreOffice 5.0.4.2 00m0(Build:2)

steak3 commented 8 years ago

It's OK for Mac and Windows now. @tafkey It should be OK for Linux too since xclip command is available in your system. Check it in a terminal. I will try to get an Arch Linux VM.

niwatako commented 7 years ago

This issue occurs for me too. I use macOS Sierra (Japanese), Atom 1.16.0, copy-as-rtf 0.9.3. Original file format I copied is UTF-8. I paste to TextEdit (supports RTF).

May be, character code of \ (back slash) is wrong.

Sample It is (U+00A5) 2017-04-21 18 36 09 ``` {¥rtf1¥ansi¥uc0¥deff0{¥fonttbl{¥f0¥fmodern¥fprq1¥fcharset0 Monaco;}}{¥colortbl;¥red0¥green0¥blue0;¥red78¥green154¥blue6;¥red0¥green0¥blue207;¥red143¥green89¥blue2;¥red245¥green121¥blue0;¥red32¥green74¥blue135;¥red128¥green0¥blue128;¥red206¥green92¥blue0;¥red248¥green248¥blue248;¥red0¥green160¥blue0;¥red52¥green101¥blue164;¥red164¥green0¥blue0;¥red92¥green53¥blue204;¥red239¥green41¥blue41;¥red196¥green160¥blue0;¥red0¥green0¥blue128;¥red204¥green0¥blue0;}¥f0 ¥fs32{¥cf1 pygmentize = }{¥cf1 require} {¥cf2 '}{¥cf2 pygmentize-bundled}{¥cf2 '}¥par {¥cf1 copy = }{¥cf1 require} {¥cf2 '}{¥cf2 copy-paste}{¥cf2 '}¥par {¥cf1 mapping = }{¥cf1 require} {¥cf2 '}{¥cf2 ./grammar-mapping}{¥cf2 '}¥par } ``` It should be (U+005C) 2017-04-21 18 36 23 ``` {\rtf1\ansi\uc0\deff0{\fonttbl{\f0\fmodern\fprq1\fcharset0 Monaco;}}{\colortbl;\red0\green0\blue0;\red78\green154\blue6;\red0\green0\blue207;\red143\green89\blue2;\red245\green121\blue0;\red32\green74\blue135;\red128\green0\blue128;\red206\green92\blue0;\red248\green248\blue248;\red0\green160\blue0;\red52\green101\blue164;\red164\green0\blue0;\red92\green53\blue204;\red239\green41\blue41;\red196\green160\blue0;\red0\green0\blue128;\red204\green0\blue0;}\f0 \fs32{\cf1 pygmentize = }{\cf1 require} {\cf2 '}{\cf2 pygmentize-bundled}{\cf2 '}\par {\cf1 copy = }{\cf1 require} {\cf2 '}{\cf2 copy-paste}{\cf2 '}\par {\cf1 mapping = }{\cf1 require} {\cf2 '}{\cf2 ./grammar-mapping}{\cf2 '}\par } ```