koordinates/kart

UnicodeEncodeError from kart conflict. Unable to see what are the conflicts.

afrigeri opened this issue · 2 comments

Describe the bug
Hello, kart conflicts for a project returns a UnicodeEncodeError:. The error is reported in both the QGIS plugin and also from the command line.

The repo is shared between Austrian and Italian users.

To Reproduce
Steps to reproduce the behaviour: kart conflicts

Expected behaviour

The list of conflicts is not reported, the user is unable to know which is/are the conflicts.

Output

from the command line:

$ kart conflicts
Traceback (most recent call last):
  File "kart_cli.py", line 4, in <module>
  File "kart\cli.py", line 410, in entrypoint
  File "click\core.py", line 1157, in __call__
  File "click\core.py", line 1078, in main
  File "kart\cli_util.py", line 72, in invoke
  File "click\core.py", line 1688, in invoke
  File "click\core.py", line 1434, in invoke
  File "click\core.py", line 783, in invoke
  File "click\decorators.py", line 34, in new_func
  File "kart\conflicts.py", line 89, in conflicts
  File "kart\conflicts_writer.py", line 246, in write_conflicts
  File "click\termui.py", line 634, in secho
  File "click\utils.py", line 318, in echo
  File "encodings\cp1252.py", line 19, in encode
UnicodeEncodeError: 'charmap' codec can't encode character '\u2400' in position 430: character maps to <undefined>
[20872] Failed to execute script 'kart_cli' due to unhandled exception!

Version Info

  • OS: Windows and OSX
  • Version: --

Kart uses U+2400 Symbol for Null - - character to indicate a null value - it assumes it's running in an environment where unicode is supported. There may be other unicode characters elsewhere in Kart or in user-data that Kart outputs.
Until and unless we make a Kart option to limit character output to ASCII (if there is sufficient interest), the workaround would have to be modify the environment so that it supports unicode.

Looking around online, the following may help add unicode support to your command line environment:

Let me know if this helps. Which terminal you are using on either platform may be relevant.

Thanks @olsen232 - that is very informative.

The error came from git-shell on windows and on the QGIS plugin. The UnicodeEncodeError was blocking the conflict display - but we turn around the problem by listing summaries of the conflicts with kart conflicts -s and solving them one by one.

Today we tried to reproduce the 'NUL' conflict but we were not able to do it. Next time we face that problem we will first try to align the environment (Windows or OSX shell) to utf-8 with the step you suggested (and report here the solution).