1. Trevor Caira
  2. timebook
  3. Issues
Issue #11 resolved

Problem with mismatched encodings for terminal and command line arguments on Windows

Alex Yakovlev
created an issue

When on Windows it seems like text encodings for terminal (cmd.exe) and command line arguments may be different. As for my RU Windows Vista, it's cp866 and cp1251 respectively.

It makes t almost unusable for real work with non-ASCII strings (timesheet names and notes) now.

{{{

!cmd

C:\src>t switch Работа

C:\src>t current ╨рсюЄр }}}

<<changeset 114b8f29fc75>> made it possible to set user encoding from command line:

{{{

!cmd

C:\src>t -e cp1251 switch Работа

C:\src>t current Работа }}}

But I hope there is a better way to solve the problem.

Current version of bzr - http://bazaar-vcs.org - works great in this regard. So I extracted bzr's code responsible for encoding guessing (from http://bazaar.launchpad.net/~bzr/bzr/trunk/annotate/head%3A/bzrlib//osutils.py).

It would be nice to integrate get_user_encoding() from bzr into timebook as a more sane default user encoding instead of sys.stdin.encoding.

Comments (5)

  1. Log in to comment