marl / marl/pysox

utf8 decoding failed on file_info.comments

Open
#128 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
540
Forks
83
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in sox/core.py around the shell_output.decode("utf-8") call at line 155, using the reported FLAC metadata to reproduce the UnicodeDecodeError. Review the proposed decode error handling and make the expected behavior clear for invalid bytes, then verify that sox.file_info.comments() handles this file successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
audio-video-rtc
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.