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

utf8 decoding failed on file_info.comments #128

Open
nefastosaturo opened this issue Jan 12, 2021 · 1 comment
Open

utf8 decoding failed on file_info.comments #128

nefastosaturo opened this issue Jan 12, 2021 · 1 comment

Comments

@nefastosaturo
Copy link

nefastosaturo commented Jan 12, 2021

Hello there,

I got this FLAC audio that displays these information when I run soxi -a audiofile.flac :

$ soxi -a 1989_7240_000022.flac 
artist=Giacomo Leopardi
DESCRIPTION=https://archive.org/details/
genre=Speech
title=13 - La sera del d� di festa
album=Canti
TRACKNUMBER=13
encoder=Lavf57.83.100

When I use sox.file_info.comments() I got an UnicodeDecodeError at

shell_output = shell_output.decode("utf-8")

in core.py, line 155

Right now I just catch that errror and call soxi as a subprocess and then decode it with

.decode("utf-8", "ignore")

but also a "replace" flag could be useful and can be given to the shell_output.decode line

https://github.com/rabitt/pysox/blob/7e0891a40ad4e29e2a67e6abf826cd048377231c/sox/core.py#L162

@nefastosaturo nefastosaturo changed the title utf8 encoding failed on file_info.comments utf8 decoding failed on file_info.comments Jan 12, 2021
@rabitt
Copy link
Collaborator

rabitt commented Feb 18, 2021

@nefastosaturo thanks for catching this! If you'd like, feel free to open a PR with the fix you propose.

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

2 participants