You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We encountered an error where vdf.load(open("config.vdf")) would crash when the vdf file contains an invalid UTF-8 character. This was reported a few times now. See DavidoTek/ProtonUp-Qt#424 for details.
We are not sure how often the error occurs and were not able to reproduce it. It is likely caused by a misconfigured system locale on Linux.
A similar issue was reported and fixed for vdf.binary_loads in ValvePython#20.
The fix we implemented looks like this (see ProtonUp-Qt PR #455). Invalid UTF-8 characters are simply replaced by "�".
withopen("config.vdf", "r", encoding="utf-8", errors="replace") asf:
x=vdf.loads(f.read())
# Something like this would probably also work - untested:vdf.load( open("config.vdf", "r", encoding="utf-8", errors="replace") )
I don't think this is something that can be fixed from your side as vdf.load only accepts the file object and the Unicode-decoding and error handling is part of open() which is called by the user. I just thought it might be interesting to share in case others also have a similar issue (this could go into "GitHub Discussions").
The text was updated successfully, but these errors were encountered:
We encountered an error where
vdf.load(open("config.vdf"))
would crash when the vdf file contains an invalid UTF-8 character. This was reported a few times now. See DavidoTek/ProtonUp-Qt#424 for details.The error occurs in this line of
vdf/__init__.py
:We are not sure how often the error occurs and were not able to reproduce it. It is likely caused by a misconfigured system locale on Linux.
A similar issue was reported and fixed for
vdf.binary_loads
in ValvePython#20.The fix we implemented looks like this (see ProtonUp-Qt PR #455). Invalid UTF-8 characters are simply replaced by "�".
I don't think this is something that can be fixed from your side as
vdf.load
only accepts the file object and the Unicode-decoding and error handling is part ofopen()
which is called by the user. I just thought it might be interesting to share in case others also have a similar issue (this could go into "GitHub Discussions").The text was updated successfully, but these errors were encountered: