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
Currently .DAT and .MEG are not alligned regarding how to handle strings in their constructors.
I'm not fully decided for either way but i'd like to bring the discussion up anyway.
Scenario: DataModels like KeyTableRecord (DAT) or MegFileNameTableRecord (Meg) require strings to have Single-byte/ASCII encoding. Their constructors allow to pass in a string value.
Discussion: Do we need data sanitazation for the string value, and if yes, at which place should it get applied?
Option 1 (MEG): The string parameter gets "re-encoded" within the constructor. The model also stores the original string value in a separate property.
Option 2 (DAT): The model is unaware of the encoding when holding the string value. This would require any consumer to ensure correct data. Since the binary models should be internal anyway, this is a valid option.
Btw: has this line key.Replace("\0", string.Empty); a specific purpose? strings in .NET are not zero-terminated, right?
The text was updated successfully, but these errors were encountered:
In terms of the DAT file I have to enforce a specific encoding otherwise things go south - so I'd probably take care of that inside the library.
The key.Replace("\0", string.Empty); was necessary in the past- It may or may not work without, but I currently don't really have the time (or the machines) to test that for at least Windows 10+ and Linux.
Currently .DAT and .MEG are not alligned regarding how to handle strings in their constructors.
I'm not fully decided for either way but i'd like to bring the discussion up anyway.
Scenario: DataModels like
KeyTableRecord
(DAT) orMegFileNameTableRecord
(Meg) require strings to have Single-byte/ASCII encoding. Their constructors allow to pass in astring
value.Discussion: Do we need data sanitazation for the
string
value, and if yes, at which place should it get applied?Option 1 (MEG): The string parameter gets "re-encoded" within the constructor. The model also stores the original string value in a separate property.
Option 2 (DAT): The model is unaware of the encoding when holding the string value. This would require any consumer to ensure correct data. Since the binary models should be
internal
anyway, this is a valid option.Btw: has this line
key.Replace("\0", string.Empty);
a specific purpose? strings in .NET are not zero-terminated, right?The text was updated successfully, but these errors were encountered: