BlenderRealtimeEngineAddon icon indicating copy to clipboard operation
BlenderRealtimeEngineAddon copied to clipboard

Use UTF8 encoding for sending JSON data

Open Moguri opened this issue 8 years ago • 2 comments

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.

Moguri avatar Jan 30 '17 22:01 Moguri

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.

oparisy avatar Jan 31 '17 21:01 oparisy

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.

Moguri avatar Jan 31 '17 22:01 Moguri