diff options
author | Tobias Brox <tobias@redpill-linpro.com> | 2020-04-13 12:01:50 +0200 |
---|---|---|
committer | Tobias Brox <tobias@redpill-linpro.com> | 2020-04-13 12:01:50 +0200 |
commit | bb19781b3cc0f9b7e4730a807bd5c0d3f23ef371 (patch) | |
tree | 230fb004ff23a6df3fb9ebb6f2d11277f042d6c8 /calendar-cli.py | |
parent | d8e5f2c3cb0e022abf60fe26e4997cd028a2821f (diff) | |
download | calendar-cli-bb19781b3cc0f9b7e4730a807bd5c0d3f23ef371.zip |
Strings printed to stdout should not be utf-8-encoded. resolves https://github.com/tobixen/calendar-cli/issues/60
Diffstat (limited to 'calendar-cli.py')
-rwxr-xr-x | calendar-cli.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/calendar-cli.py b/calendar-cli.py index 77e33c2..27a037d 100755 --- a/calendar-cli.py +++ b/calendar-cli.py @@ -35,13 +35,13 @@ import sys import re import urllib3 from getpass import getpass +from caldav.lib.python_utilities import to_normal_str ## ref https://github.com/tobixen/calendar-cli/issues/33, python3-compatibility try: raw_input except NameError: raw_input = input - sys.stderr.write("here be dragons - calendar-cli is not properly tested for python3. See https://github.com/tobixen/calendar-cli/issues/33") try: unicode @@ -526,7 +526,7 @@ def calendar_agenda(caldav_conn, args): ## TODO: this will probably break and is probably moot on python3? for attr in vcal_txt_one + ['summary']: if isinstance(event[attr], unicode): - event[attr] = event[attr].encode('utf-8') + event[attr] = to_normal_str(event[attr]) print(args.event_template.format(**event)) def todo_select(caldav_conn, args): @@ -670,7 +670,7 @@ def todo_list(caldav_conn, args): t['uid'] = task.instance.vtodo.uid.value ## TODO: this will probably break and is probably moot on python3? if hasattr(t['summary'], 'encode') and isinstance(t['summary'], unicode): - t['summary'] = t['summary'].encode('utf-8') + t['summary'] = to_normal_str(t['summary']) print(args.todo_template.format(**t)) def todo_complete(caldav_conn, args): |