TIP #106 Version 1.3: Add Encoding Abilities to the [dde] Command

This is not necessarily the current version of this TIP.


TIP:106
Title:Add Encoding Abilities to the [dde] Command
Version:$Revision: 1.3 $
Author:Harald Oehlmann <Harald dot Oehlmann at Elmicron dot de>
State:Draft
Type:Project
Tcl-Version:8.5
Vote:Pending
Created:Tuesday, 13 August 2002

Abstract

When using Windows DDE communication with non-Tcl programs, the encoding of the exchanged strings is mostly needed to be the system encoding. Selection of this behaviour should be possible with in the [dde] command should be done by a parameter.

Specification

Extend the [dde] command by the option -encoding. For example:

 dde -encoding system execute CS CS {[Set(Var,"Äpfel"]}

The default value for the encoding is utf-8 for backward compatibility.

Rationale

The communication with DDE with external programs uses the format clipboard CF_TEXT and the sent text should be coded in the system encoding (cp1252 in my locale).

Most people who use DDE to communicate with, for example, Excel use the fact that what Excel expects (cp1252) and what Tcl actually sends (utf-8) is identical for 7-bit values and they don't use 8-bit values. Unfortunately, characters needed in German, French and other languages are located over this limit and thus are not transferable.

Peter Hardie addressed this point on 2000-10-26 in the Tcl Feature Request at SourceForge (#219185: "dde only handles UTF-8 data (-binary patch available)" [1]). His proposal was to add a -binary option. I think that an -encoding option is more general purpose and needs only very little supplementary coding.

It is envisaged that the main needed encodings will be:

utf-8

For Tcl-to-Tcl communication.

system

For the communication with other programs.

binary

To fully control the sent data.

Reference Implementation

May be done after discussion.

Copyright

This document has been placed in the public domain


Powered by TclThis is not necessarily the current version of this TIP.

TIP AutoGenerator - written by Donal K. Fellows