[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Patch] Unicode support for the MS Windows clipboard

From: Jason Rumney
Subject: Re: [Patch] Unicode support for the MS Windows clipboard
Date: Thu, 27 May 2004 08:58:03 +0100
User-agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (windows-nt)

Benjamin Riefenstahl <address@hidden> writes:

> As we just had another discussion on this, I sat down and wrote a
> preliminary implementation of Unicode support for the MS Windows
> clipboard, see attached patch.

Thank you, this was the next thing on my todo list. The recent
changes to use cpXXXX as default coding-system on Windows were
intended to make this easier (see my CF_LOCALE comment below).

Your patch doesn't seem to contain any special handling for the
different types, so it seems that the user must take care to set
selection-coding-system appropriately for w32-clipboard-type. If that
is the case, it might be better to get rid of w32-clipboard-type as a
user variable, and determine the type automatically from
selection-coding-system instead. cp<900 should map to OEM, utf16
to unicode, and others to ANSI. Maybe it would be useful to map utf8
to utf16, and the various utf-16 endians to the correct one (I can
never remember which Windows uses, I would be surprised if most users

Also, we should set (and read) CF_LOCALE when we are using CF_TEXT, to
indicate the coding we have used. This will be easy when clipboard
coding system is cpXXXX, so even if we just do it in those cases
would be an improvement.

Here are some thoughts I'd had:

When reading from the clipboard, if CF_UNICODE is present, it might be
better to use that (ignoring selection-coding-system). On the other
hand, some Chinese characters are still not covered by Emacs' unicode
support (even with utf-translate-cjk-mode), so it might be better to
use CF_TEXT when selection-coding-system is set to one of the CJK
coding-systems (I am not sure about Japanese and Simplified Chinese
coverage, Korean is probably OK if they are only using Hangeul but
they might use the odd Hanja, Big5 is definitely not entirely

When writing to the clipboard, if we know CF_UNICODE is supported,
using it might produce better results, but if text can be encoded in
selection-coding-system, then using that and setting CF_LOCALE
appropriately will be guaranteed to work on more platforms.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]