BlenderRealtimeEngineAddon
BlenderRealtimeEngineAddon copied to clipboard
Use UTF8 encoding for sending JSON data
We currently force ASCII encoding when sending JSON data over the socket (https://github.com/Kupoman/BlenderRealtimeEngineAddon/blob/cf1825a0cb933af277609279039121e33b55b837/brte/processors/external_processor.py#L52). We should explore using UTF8 for wider compatibility.
You expressed in #10 a concern for the impact on messages size of an UTF8 encoding.
I specifically suggested it with this issue in mind, since ASCII characters (the only valid ones with the current ascii
encoding) are represented by one byte in UTF8
. Only language-specific characters will consume more bits, and they will be only infrequently encountered in western languages.
I cannot talk for other languages, for which other encodings may be more appropriate/compact (and I do not know what the level for support for those in Blender is).
Still, my understanding is that this encoding will only have an impact on elements names, which should not be the bulk of transmitted glTF data. So UTF8 should not have any practical drawbacks IMHO.
Regards, Olivier.
I double-checked how UTF8 handles actual encoding, and you are correct. I agree with your assessment that this will have minimal impact on the data size and we really should be Unicode friendly.