views:

296

answers:

5

Copying text from websites via browser, paste into xemacs (21.4) buffer, and tildes, quotes, etc. don't copy correctly.

Example: he’s a dummy -> he\222s a dummy.

Can YOU copy & paste it without problems? If so, please help - how to config my .emacs to solve this. Thanks.

+2  A: 

You're attempting to copy+paste smart quotes into XEmacs. In this case, '\222' is the octal code for the character RIGHT SINGLE QUOTATION MARK (U+2019) encoded in the code page Windows-1252, which has the character encoding 0x92.

XEmacs uses UTF-8 internally, so you'll have to configure the copy+paste to convert from Windows-1252 to UTF-8. I don't know how to do that.

Adam Rosenfield
thanks Adam - great to know what is going on; hopefully someone will know how to solve it.
jd
A: 

Simplest thing to do is write a quick function that translates those characters using replace-string.

You could also have xemacs set to accept that code page directly.

Charlie Martin
A: 

Switch to emacs, it works like a champ (GNU Emacs 23.0.91.1 (i386-mingw-nt6.0.6002) from Emacsw32 here). This may be the Emacsw32 patches in action.

Ben Straub
+1  A: 

Fire this in your .emacs:

(set-clipboard-coding-system 'utf-16le-dos)

That should do it. Don't forget to thi C-x C-e on that statement, or restart xemacs.

Jonathan Arkell
update: i tried the above and get an error (symbol's function definition is void: set-clipboard-coding-system). Now I'm trying to figure out in which package that function is contained so that I can load it. I find that many people set this function in their config (mostly to deal with Asian languages' characters), so I feel I'm getting somewhere, just not there yet...
jd
set-clipboard-coding-system is an alias for `set-selection-coding-system' in `mule.el'.Hope that helps!
Jonathan Arkell
+2  A: 

This isn’t a clipboard or cygwin problem. If you save a UTF-8 text file with curly quotes in notepad and open it in XEmacs 21.4, you’ll get junk. According to the XEmacs reference documentation, Unicode is not supported before version 21.5.6. Maybe try a later version?

andrew
this worked; followed the links that you included above; installed latest xemacs version listed in the cygwin website (21.5 - experimental, but no problems) - thanks.
jd