Skip to content

function log_default throw an UnicodeDecodeError on Windows(Chinese) #176

@BobXGY

Description

@BobXGY

Windows console default encoding is gbk.
Function log_default can not specific an encoding type.
once I call svn_remote.log_default() to get a svn repo's log with encoding utf8, there will be an error.

Traceback (most recent call last):
  File "D:/Proj/Python/myscript/module_svn.py", line 15, in <module>
    main()
  File "D:/Proj/Python/myscript/module_svn.py", line 10, in main
    print(next(svn_remote.log_default()))
  File "D:\Software\Python37\lib\site-packages\svn\common.py", line 251, in log_default
    do_combine=True)
  File "D:\Software\Python37\lib\site-packages\svn\common.py", line 60, in run_command
    return self.external_command(cmd, environment=self.__env, **kwargs)
  File "D:\Software\Python37\lib\site-packages\svn\common_base.py", line 29, in external_command
    universal_newlines=decode_text)
  File "D:\Software\Python37\lib\subprocess.py", line 376, in check_output
    **kwargs).stdout
  File "D:\Software\Python37\lib\subprocess.py", line 455, in run
    stdout, stderr = process.communicate(input, timeout=timeout)
  File "D:\Software\Python37\lib\subprocess.py", line 907, in communicate
    stdout = self.stdout.read()
UnicodeDecodeError: 'gbk' codec can't decode byte 0xae in position 170: illegal multibyte sequence

Process finished with exit code 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions