[Top][All Lists]

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

[Patch] Unicode support for the MS Windows clipboard

From: Benjamin Riefenstahl
Subject: [Patch] Unicode support for the MS Windows clipboard
Date: Wed, 26 May 2004 20:01:22 +0200
User-agent: Gnus/5.1001 (Gnus v5.10.1) Emacs/21.3.50 (gnu/linux)

Hi everybody,

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.

I assume some of you have opinions on how this should be actually be
packaged, so this patch is mostly for introduction, testing and
playing around.  If this code is acceptable in principle, I will
probably also need to send in papers for the copyright assignment,
before it can be used.

What does it do:

- Introduce a new variable `w32-clipboard-type' to use with
  cut-and-paste instead of the hard-coded CF_TEXT.  The default for
  `w32-clipboard-type' is CF_TEXT, because CF_UNICODETEXT is not
  compatible with 9x/Me, it uses more memory and CF_TEXT was used

- Drop optimizations for ASCII-only text.  This is mostly because I
  couldn't get all combinations straight in my mind, between this, the
  `last_clipboard_text' mechanism and CF_UNICODETEXT.

Open questions:

- Support for CF_OEMTEXT (console text) in the clipboard may look
  superfluous.  OTOH this may be usefull for full console mode support
  (emacs -nw) on 9x/Me.  If we keep this, the default for
  `w32-clipboard-type' should depend on the display mode (console vs
  GUI).  In that case `w32-clipboard-type' should be set from the Lisp
  code, though, I think.

- `selection-coding-system' and `w32-clipboard-type' need to be set in
  a synchronized manner.  I'm not yet sure if we want this to be done
  by Lisp code or by combining/synchronizing the two variables in the
  C code somehow.

  If we keep them separate, users can in theory use other
  coding-systems with this as they see fit.  They can adapt it to
  whatever exotic locales and coding-systems that they may have.  But
  that may be an academic issue.

  Anyway, as long as they are kept separate, these are the recommended
  combinations for an English version of Windows:

      w32-clipboard-type | selection-coding-system
      CF_TEXT            | cp1252-dos (GetACP())
      CF_OEMTEXT         | cp850-dos (GetOEMCP())
      CF_UNICODETEXT     | utf-16le-dos

- If we keep `w32-clipboard-type', we could try to use more
  user-oriented names for the different types instead of just taking
  them from the C API names.

- We want to either drop the #if 0 sections in the code completly or
  make that code work.


Attachment: w32select.c.patch
Description: Text Data

reply via email to

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