[OS X Emacs] ISO-8859-1 to UTF-8? (was: NSEmacs: copying and pasting long lines without the backslash)

Lloyd Zusman ljz at asfast.com
Sun Nov 2 10:31:38 EST 2008


Lloyd Zusman <ljz <at> asfast.com> writes:

> [ ... ]
> 
> I want to be able to type long lines in emacs and then select them
> in a such way so that when I copy and paste them into a different
> application, each long line gets copied as is, without being split
> and without the backslash character at the end of each of the split
> lines.
>
> [ ... ]

Well, I found an incomplete solution. The NeXTStep (GNUStep) code that
NSEmacs is built on offers this function: `ns-copy-including-secondary'.
It does the same thing as `kill-ring-save', and in addition, it puts
the text into the Mac's paste buffer.

The problem with this function is that it doesn't work when I'm using
8-bit ASCII text. I use this a lot with the ISO-8859-1 encoding in
order to write text that includes characters with Spanish diacritical
marks. As soon as `ns-copy-including-secondary' encounters one of these
special characters, it fails and leaves the Mac's paste buffer empty.

I looked through the source code, and I think that this function is
somehow expecting the pasted text to be in UTF-8, or at least to be
convertable into that encoding. This begs a new question: is there
a function in Emacs 23.0.60.1 which will convert an ISO-8859-1 string
into UTF-8? If so, I can write my own version of
`ns-copy-including-secondary' which performs this conversion before
putting the text into the secondary paste buffer.

Thanks again, in advance.

-- 
 Lloyd Zusman
 ljz at asfast.com
 God bless you.







More information about the MacOSX-Emacs mailing list