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

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf0 in position 0: invalid continuation byte #195

Closed
m3nthal opened this issue Apr 30, 2018 · 3 comments

Comments

@m3nthal
Copy link

m3nthal commented Apr 30, 2018

def decode(byte_data):
    """
    Decode the byte data to a string if not None.

    :param bytes byte_data: the data to decode

    :rtype: str
    """
    if byte_data is None:
        return None
    return byte_data.decode()

when receives byte_data = b'\xf0\x01ActiveMQ' raises:

stomp/backward3.py", line 29, in decode
return byte_data.decode()
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf0 in position 0: invalid continuation byte

https://docs.python.org/3/library/stdtypes.html#bytes.decode
This could be fixed to by changing errors parameter from default errors="strict":

>>> b'\xf0\x01ActiveMQ'.decode(errors="ignore")
'\x01ActiveMQ'
>>> b'\xf0\x01ActiveMQ'.decode(errors="replace")
'�\x01ActiveMQ'
>>> b'\xf0\x01ActiveMQ'.decode(errors="strict")
Traceback (most recent call last):
  File "<input>", line 1, in <module>
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf0 in position 0: invalid continuation byte
@jasonrbriggs
Copy link
Owner

I think I've fixed the issue here: #200

@sanghaimuskan
Copy link

utf-8' codec can't decode byte 0xf0 in position 1718: invalid continuation byte

I am fetching this error:
code:

clip = mp.VideoFileClip(r"no.mp4")

clip.audio.write_audiofile(r"no.wav")
and the video file is fine.

@jasonrbriggs
Copy link
Owner

jasonrbriggs commented Aug 30, 2020

Failing to see what your code excerpt has to do with stomp.py

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