Dear PyBIS-developer,
I stumbled about some changes in the pybis module since one of the last updates:
I really appreciate that you are striving to simplify the handling of spreadsheets by integrating decoding and JSON handling and outputting a dict directly.
However, many objects can no longer be loaded via
# for example
sample = o.get_object("20250221115502283-49917")
as soon as there is content in the spreadsheet or the content contains special characters that are not recognized by utf-8.
101 def to_spreadsheet(self, rawValue):
102 b64 = rawValue[len("<DATA>"):-len("</DATA>")]
--> 103 json_str = base64.b64decode(b64).decode('utf-8')
104 result = json.loads(json_str)
105 return Spreadsheet.from_dict(result)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xdf in position 2376: invalid continuation byte
If German umlauts, ß or ° occur, the decoding fails.
In the previous versions I was able to adjust the character set:
json_str = base64.b64decode(coded_string).decode("latin-1")
data_dict = json.loads(json_str)
But now I can’t even load the object in its entirety.
And that affects a lot of existing objects. At the same time, I can’t convince users to design spreadsheets without using ° or umlauts (ä,ö,ü)…
I would be happy if you could provide a solution for this in future updates.
Cheers,
Volker