Unicode & the tutorial

20 views
Skip to first unread message

Mark D Blackwell

unread,
Mar 25, 2019, 7:06:28 PM3/25/19
to Tk Documentation and Resources
While searching the Stack Overflow website for questions about Tk and Ruby (i.e., posts containing 'ruby tk'), I came upon a question about the use of Unicode.

Thus inspired, I looked into how to use Unicode with Tk in the computer languages Perl, Python, and Ruby. Here's what I found:

Two of the three languages need additions to the source code of a program, in order to be in Unicode mode:
  •  Perl 5 (in particular, version 5.20.2 with Tk 8.6.2 on Debian 'jessie') needs the following:
use utf8;
binmode STDOUT, ":utf8";
  • Ruby (in particular, version 2.2.5 with Tk 8.5.12 on Windows 7) needs the following. (Here, the first line is a magic comment at the top of the file.):
# coding: utf-8
Tk::Encoding.encoding = "".encoding
  • Python 3 (in particular, version 3.6.4 with Tk 8.6 on Windows 7) seems to handle Unicode well, and automatically selects it.
  • I'll leave investigating how to use Unicode with Tk from the computer language Tcl for someone else. ;)
Nowadays, Unicode seems to be used everywhere. Arguably, a tutorial which promotes real-world (and/or "professional") usage of modern Tk from multiple computer languages (around the world) should include how to switch Tk into "Unicode mode." :)
Reply all
Reply to author
Forward
0 new messages