Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
BobXGY opened this issue Mar 3, 2021 · 3 comments
Open

Comments

@BobXGY
Copy link

BobXGY commented Mar 3, 2021

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

@BobXGY
Copy link
Author

BobXGY commented Mar 3, 2021

I add an argument to function external_command, class CommonBase, in common_base.py, this problem has been solved.
can author do some optimization?

@frozenzj
Copy link

I add an argument to function external_command, class CommonBase, in common_base.py, this problem has been solved. can author do some optimization?

hi,could you share your scripts? I've faced the same problem.

@HamSeokHeon
Copy link

HamSeokHeon commented Aug 1, 2022

I add an argument to function external_command, class CommonBase, in common_base.py, this problem has been solved. can author do some optimization?

hi,could you share your scripts? I've faced the same problem.

I solved it when add an argument encoding="utf-8" to subprocess.check_output in function external_command in common_base.py.

I used python 3.10.5 on window10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants