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

Text encoding breaks rpi-source #20

Open
melissaboiko opened this issue Sep 22, 2023 · 4 comments
Open

Text encoding breaks rpi-source #20

melissaboiko opened this issue Sep 22, 2023 · 4 comments

Comments

@melissaboiko
Copy link

I'm getting this on a freshly installed script per README:

 *** Linux source commit: df4d584e66a660195422ca2b7ce1d68d1181f2a2
Traceback (most recent call last):
  File "/usr/local/bin/rpi-source", line 366, in <module>
    check_diskspace(args.dest)
  File "/usr/local/bin/rpi-source", line 178, in check_diskspace
    df = sh_out("df %s" % dir)
         ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/bin/rpi-source", line 101, in sh_out
    return out.decode('ascii')
           ^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 20: ordinal not in range(128)

If I experimentally change the line from 'ascii' to 'utf-8' it works, so it's probably a matter of properly setting up the console to the current running locale.

@pelwell
Copy link
Member

pelwell commented Sep 25, 2023

Out of interest, what might the value of dir have been?

@pelwell
Copy link
Member

pelwell commented Sep 25, 2023

Since UTF-8 is backwards compatible with ASCII for values 0-127, I can't think of a reason not to change all occurrences of ascii to utf-8. What do you think, @popcornmix?

@popcornmix
Copy link

I believe utf-8 is the default for strings with python 3, so yes, I don't think we should use ascii without a good reason.

pelwell added a commit that referenced this issue Sep 25, 2023
See: #20

Signed-off-by: Phil Elwell <[email protected]>
@pelwell
Copy link
Member

pelwell commented Sep 25, 2023

Fixed by #21.

pelwell added a commit that referenced this issue Sep 25, 2023
See: #20

Signed-off-by: Phil Elwell <[email protected]>
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