Skip to content Skip to sidebar Skip to footer

Utf8' Codec Can't Decode Byte 0x89 In Position 15: Invalid Start Byte

This is a view for my project in which I am trying to upload images from my local system to s3 using boto. class ImageList(generics.ListCreateAPIView): queryset = Image.ob

Solution 1:

JSON strings are unicode strings, not binary strings. Your image contains binary data, and the JSON serializer is complaining about that.

One common approach to work around this problem is to use base64 or base85. Python has builtin support for those two (and other) encodings via the base64 module.


Post a Comment for "Utf8' Codec Can't Decode Byte 0x89 In Position 15: Invalid Start Byte"