Subject: Re: Cut and paste Unicode plain text
From: Mike Nordell (tamlin@algonet.se)
Date: Tue Jun 05 2001 - 08:39:21 CDT
Andrew Dunbar wrote:
>
> > Oh, I didn't know that. Does it add a CF_LOCALE for every
> > SetClipboardData? (a plain URL will do)
>
> I thought CF_LOCALE was just for plain text but RTF and HTML
> also could behave a bit differently depending on locale.
AFAIK it's only CF_TEXT that is (to be) affected, but I might be wrong.
Imagine you're going from one locale where e.g. 0xd7 means one thing (and
copy some text using that locale), to another locale where it means
something completely different and then try to paste it into a non-RTF
editor.
I don't know if e.g. MSWord cares about this, but even if it doesn't I don't
think thats a reason to behave as bad. :-)
I've heard e.g. Thai have a bunch of > 0x80 8-bit chars that has no
correlation to e.g. 8859-1.
> > > But since the user can change the input locale at
> > > any time we may be able to improve it.
> >
> > Hence my question about adding CF_LOCALE to our "clips". Imagine
> > copying (8-bit) text using one locale, changing locale and the pasting.
> > We'd still assume the original chars to be pasted I think.
>
> Well we just treat the clipboard as raw bytes now so we will
> interpret anything outside ASCII wrongly if we paste under a different
> locale.
Then we will have to change that, wont we? If we get a "Paste" command and
there is only CF_TEXT available, we'll have to check the clipboard for
existance of locale info.
[using CF_UNICODETEXT also]
> I haven't explored all cases but Windows does do automatic conversions
> when possible.
It does? Are you talking about trying to *get* Unicode as CF_TEXT (where no
CF_TEXT really is available) and it "automagically" converts what it can to
your locale? (I might be a Win32 guru, but these areas are *really* dark to
me... :-) ).
> There's at least some bonuses to always putting
> CF_UNICODE on the clipboard.
But there's also a drawback that I really don't want. If only pasting 8-bit
text that we can express in the source locale charset, I'd hate to waste
more than three times more memory than needed (says the one that thinks it's
nothing out of the ordinary to open a 3 MB text file and copy & paste inside
it) to put it on the clipboard.
On a sidenote: perhaps we should keep track of how much we have put on the
clipboard and ask the user if it wants to discard it if it reaches a
threshold? Some other programs does)
> One is that it means we always take
> control, another I can think of is that our smart quotes will be
> preserved, so will anything the user got from the "insert symbol"
> dialog.
But we have to cooperate with other apps. Smart quotes or not.
Wait a minute! Does anyone know what WinWord puts in the different clipborad
data "streams" when its smartquotes is turned on?
/Mike
This archive was generated by hypermail 2b25 : Tue Jun 05 2001 - 08:38:59 CDT