Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

I can't type Unicode into text widgets

120 views
Skip to first unread message

Luc

unread,
Mar 29, 2023, 4:03:10 PM3/29/23
to
In Linux, I can type any (or almost any) Unicode character into
text editors such as Leafpad, Pluma and Vim by holding Ctrl+Shift+U
and typing the Unicode code. For example, Ctrl+Shift+U+2013 makes —.

Why doesn't that work in my Tcl/Tk text widgets?


--
Luc
>>

saitology9

unread,
Mar 29, 2023, 4:46:35 PM3/29/23
to
You probably have an incompatible encoding.
Do this and see if things improve:

% encoding system utf-8

Luc

unread,
Mar 29, 2023, 5:37:47 PM3/29/23
to
It had no effect in Tkcon. Do you suggest another approach?

--
Luc
>>

saitology9

unread,
Mar 29, 2023, 5:44:17 PM3/29/23
to
On 3/29/2023 5:37 PM, Luc wrote:
>
>
> It had no effect in Tkcon. Do you suggest another approach?
>

Interesting - it works here even from a plain tclsh shell on command
line as well as in text widgets, etc. I tested with emojis from here:
https://www.unicode.org/emoji/charts/emoji-list.html

What OS and what version are you using?

saitology9

unread,
Mar 29, 2023, 5:52:38 PM3/29/23
to
What happens when you copy/paste an emoji directly like from that site?

Because it may be the way you are entering these characters. I can't
type Ctrl+Shift+U+2013 on my keyboard as the modifier sequence breaks on
the "U". Too many modifiers :-) Maybe check the text widget doc's to
see how you are supposed to type it in.



Rich

unread,
Mar 29, 2023, 5:57:56 PM3/29/23
to
Because you have not implemented it for your text widgets.

X does not provide a "unicode hex entry" subsystem. So handling entry
of unicode via typing the hex code is left up to the individual
applications to implement.

Most of them use a gui toolkit (GTK or QT) and this keystroke is
probably part of the library, so it comes along for free for the
individual apps.

Tk is its own 'gui library' and it does not build in a "enter hex of
unicode code point" feature. So you have to add it on yourself.

Gerald Lester

unread,
Mar 29, 2023, 6:28:45 PM3/29/23
to
Luc, that being said, if you develop such a set of bindings for the
Entry and Text widgets, you may want to consider packaging them up and
submitting them to TkLib.

D Groth

unread,
Mar 30, 2023, 12:32:04 PM3/30/23
to

Luc

unread,
Mar 30, 2023, 11:30:06 PM3/30/23
to
I use Debian Linux. What about you?


--
Luc
>>

Luc

unread,
Mar 30, 2023, 11:32:40 PM3/30/23
to
On Wed, 29 Mar 2023 17:52:33 -0400, saitology9 wrote:

> What happens when you copy/paste an emoji directly like from that site?

Pasting from elsewhere works, although "emojis" usually refers to a
relatively new bunch of Unicode characters that Tcl doesn't even support
except for one package whose name I forget.


--
Luc
>>

Luc

unread,
Mar 30, 2023, 11:35:50 PM3/30/23
to
Gerald, I am deeply honored by the enormous amount of confidence you deposit
in me and my abilities and I am sad to disappoint you. I'm afraid I cannot
undertake such task because I wouldn't even know where to start and I know
I would never be able to finish it. Genuinely sorry.


--
Luc
>>

Luc

unread,
Mar 30, 2023, 11:38:16 PM3/30/23
to
On Thu, 30 Mar 2023 09:32:00 -0700 (PDT), D Groth wrote:

> May be this helps:
>
> https://wiki.tcl-lang.org/page/Entering+Unicode+characters+in+a+widget
>
> Best,
> Detlef


It does. It works! It works pretty well.

Except that I added it to my text editor and now many - not all - of the
key bindings won't work anymore. I will have to have a closer look into
that code and see if I can figure out what is going on.

Very handy! Thank you.

--
Luc
>>

D Groth

unread,
Mar 31, 2023, 2:12:45 AM3/31/23
to
Hmm, I added as well an oowidgets example for easier use to the oowidgets Wikipage at the very end.

https://wiki.tcl-lang.org/page/oowidgets

or here embedded into the oowidgets project the manual page:

https://htmlpreview.github.io/?https://raw.githubusercontent.com/mittelmark/oowidgets/master/paul/txmixins.html

Which keybindings did not work anymore?

Detlef

Luc

unread,
Apr 2, 2023, 11:42:19 PM4/2/23
to
On Thu, 30 Mar 2023 23:12:42 -0700 (PDT), D Groth wrote:

> Hmm, I added as well an oowidgets example for easier use to the oowidgets
> Wikipage at the very end.
>
> https://wiki.tcl-lang.org/page/oowidgets
>
> or here embedded into the oowidgets project the manual page:
>
> https://htmlpreview.github.io/?https://raw.githubusercontent.com/mittelmark/oowidgets/master/paul/txmixins.html
>
> Which keybindings did not work anymore?
>
> Detlef


These bindings don't work anymore while all others still work:

bind $::w <Control-KeyRelease-f> {p.searchreplace}
bind $::w <Alt_L><j> {p.gui6.switchtop}
bind $::w <Alt_L><q> {exit 0}


I've read that script many times and I can't really understand
how it is supposed to work so I can't find out why some bindings
won't work anymore.


--
Luc
>>

D Groth

unread,
Apr 3, 2023, 4:20:32 AM4/3/23
to
There is now an update from BEO in the wiki which says it does not interfere with other bindings:

Could you try this out?

https://wiki.tcl-lang.org/page/Entering+Unicode+characters+in+a+widget

Detlef

dave bruchie

unread,
Apr 3, 2023, 11:30:21 AM4/3/23
to
you might try replacing these bindings:

> > bind $::w <Alt_L><j> {p.gui6.switchtop}
> > bind $::w <Alt_L><q> {exit 0}

with

bind $::w <Alt-j> {p.gui6.switchtop}
bind $::w <Alt-q> {exit 0}

Dave B

Luc

unread,
Apr 3, 2023, 1:05:33 PM4/3/23
to
> There is now an update from BEO in the wiki which says it does not
> interfere with other bindings:
>
> Could you try this out?
>
> https://wiki.tcl-lang.org/page/Entering+Unicode+characters+in+a+widget
>
> Detlef


Yes, the new one works as expected. Excellent! Thank you!

Please send my regards to BEO, whoever that is.

--
Luc
>>

0 new messages