git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] gitk: Fix display of copyright symbol in non-utf-8 locales

From
Pat Thoyts <patthoyts@users.sourceforge.net>
Date
Mar 22, 2010, 22:58 UTC
Message-ID
<87pr2wc6bo.fsf@fox.patthoyts.tk>
In-Reply-To
<20100320061452.GA26224@progeny.tock>
Jonathan Nieder <jrnieder@gmail.com> writes:
Show 48 quoted lines
>Unless the ‘-encoding’ option is supplied, wish interprets source
>files using the default system encoding, which depends on locale.
>This can cause the copyright symbol to display incorrectly in gitk’s
>about dialog.
>
>The -encoding option was added to tcl in version 8.1.
>
>Reported-by: Pat Thoyts <patthoyts@users.sourceforge.net>
>Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
>---
>Hi,
>
>Pat Thoyts wrote:
>
>> The script file uses utf-8 encoding but when sourced it will be read
>> using the default system encoding which is never utf8 on windows. This
>> causes the copyright symbol to display incorrectly in the about dialog.
>
>I can reproduce this in Linux with LANG=de_DE@euro ./gitk.
>
>> Using the unicode escape sequence avoids incorrect decoding but does
>> require a double escape in the .po files.
>
>When I tried applying your patch, running “make update-po” seemed to
>undo its effect on translations.  I am also worried about what would
>happen in locales where ASCII is not a subset of the native character
>set, or other uses of non-ASCII characters in the translated messages.
>
>Maybe the following would be safer?  I haven’t looked at the effect on
>translations yet.
>
> gitk |    2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
>diff --git a/gitk b/gitk
>index 1f36a3e..a7c9a9a 100755
>--- a/gitk
>+++ b/gitk
>@@ -1,6 +1,6 @@
> #!/bin/sh
> # Tcl ignores the next line -*- tcl -*- \
>-exec wish "$0" -- "$@"
>+exec wish -encoding utf-8 "$0" -- "$@"
> 
> # Copyright © 2005-2009 Paul Mackerras.  All rights reserved.
> # This program is free software; it may be used, copied, modified
>-- 
>1.7.0.2

I would much rather see any fault in the makefile fixed than use source -encoding in all the various places this script might get loaded from. THere are two characters in this file that are not ASCII and one of them is in a comment. We could even just use (c) to simplify this. However, \u00a9 is the correct unicode escape sequence for tcl to get a copyright character into the script in a way that is independent of the encoding. The escape sequence should be passed through unchanged in any translations - tcl wants to see exactly \u00a9 and everyone is using a copyright glyph here.

-- 
Pat Thoyts                            http://www.patthoyts.tk/
PGP fingerprint 2C 6E 98 07 2C 59 C8 97  10 CE 11 E6 04 E0 B9 DD
Previous: Jonathan NiederNext: Jonathan Nieder
Message 6 of 10 in “gitk: Avoid calling tk_setPalette on Windows”
  1. 1/3 gitk: Avoid calling tk_setPalette on WindowsPat Thoyts, Mar 12, 2010
  2. 2/3 gitk: Add emacs editor variable block.Pat Thoyts, Mar 12, 2010
  3. 3/3 gitk: fix display of copyright symbolPat Thoyts, Mar 12, 2010
  4. gitk: Fix display of copyright symbol in non-utf-8 localesJonathan Nieder, Mar 20, 2010
  5. gitk: Update makefile to keep -encoding option for gitk-wishJonathan Nieder, Mar 20, 2010
  6. Pat ThoytsMar 22, 2010
  7. Jonathan NiederMar 22, 2010
  8. Jonathan NiederMar 20, 2010
  9. Pat ThoytsMar 22, 2010
  10. Jonathan NiederMar 23, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.