Sujet : Re: Remove new line char
De : rich (at) *nospam* example.invalid (Rich)
Groupes : comp.lang.tclDate : 21. Mar 2025, 13:59:44
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vrjns0$1jnjj$1@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10
User-Agent : tin/2.6.1-20211226 ("Convalmore") (Linux/5.15.139 (x86_64))
Harald Oehlmann <
wortkarg3@yahoo.com> wrote:
Am 20.03.2025 um 19:03 schrieb Rich:
alexandru <alexandru.dadalau@meshparts.de> wrote:
I tried
>
set text [encoding convertfrom cp1252 $text]
>
but no success.
Are you sure the clipboard is cp1252?
If it is utf-8 then converting as if it is cp1252 will create strange
results.
Dear Rich,
the Windows clipboard is more complicated/sophisticated.
Yes, that I am well aware.
Each entry has a type. This is nowdays mostly CF_UNICODETEXT, which is
16 bit unicode.
A sending application can put an entry into the clipboard in multiple
formats and the receiving application can pick one or more.
Yes, but alexandru's example he posted, he's not picking a format from
the clipboard, he's assuming it was cp1252 and forcefully decoding it
as if it was cp1252. If he left out telling us he requested cp1252
from the clipboard then that's on him.
We have often "enhanced" this code in TCL to adopt it to modern
usage. There should not be any issues with the encoding, expect that
the sending application does anything strange.
This is good, because handling the clipboard on windows is an ugly
beast. My comment was to what alexandru posted showing simply forcing
a decode as if what he got was cp1252, without showing he asked the
clipboard to supply cp1252 data.