Scirra / Construct-feature-requests

A place to submit feature requests and suggestions for Construct.
https://www.construct.net
9 stars 1 forks source link

Binary Data - optional text decoding #24

Open henrikszucs opened 6 months ago

henrikszucs commented 6 months ago

Reviewed guidelines

Checked for duplicate suggestions

Summary

Binary Data's GetText and GetAllText expressions get an optional string parameter that contains the decoding scheme in string (now the only one is 'utf-8')

Possible workarounds or alternatives

Need native JavaScript TextDecoder API

Proposed solution

GetText and GetAllText expressions get an optional string parameter that contains the decoding scheme in string (default will 'utf-8')

BinaryData.GetText(ByteOffset, Length, decoding); BinaryData.GetAllText(decoding);

Why is this idea important?

Users might want to load other encoded text files like excel generated csv or text from different operating systems. Special characters often misdecoded if text files are from Windows.

Additional remarks

No response

AshleyScirra commented 6 months ago

I think it's better to say: use UTF-8 everywhere. It avoids things like mis-decoded text in the first place.

henrikszucs commented 6 months ago

Yes I totally agree with that practice (everybody should use UTF-8) but the sad experience that Excel and other editing software (especially in Windows) saves text files in other encoding format. If users edit a CSV table in Excel and try to load most of the cases the encoding will be wrong and in a runtime there is no option to change the decode (reading) format. Okay user can convert and save correctly the text files but my experience most of the user cannot do that (or do not want), it is easier that they can choose the decoding (reading) in the Construct 3 project.