opensim-gui
opensim-gui copied to clipboard
TRC files using UTF-8 byte order mark will result in error
.trc-files using UTF-8 with a byte order mark (BOM; https://en.wikipedia.org/wiki/Byte_order_mark) will result in "[path] does not appear to be a valid TRC". @ssebastianskejoe
Can you provide a file that produces this problem? Thanks!
Attached file should produce the problem. Otherwise saving files in Windows Notepad automatically converts the file to UTF-8 BOM.
@sebastianskejoe While we can fix this for the trc file reader to not throw an error due to leading BOM, I don't know if other files may have similar parsing issues or if you have the option to not write BOM altogether. Some context regarding prevalence would definitely help. Also keep in mind that while the tools will use the new TRC parsing, the GUI uses a different parser at the moment.
Note that as of now you get an exception rather than a crash both in the GUI and API.
We encountered the problem because some markers were wrongly named in one file and thus students manually changed them in Notepad. So this problem could be avoided if:
- We had used a proper tracking workflow instead of the "student workflow" we used due to time constraints.
- We had changed the marker names in the tracking software rather than manually.
- We did not use Notepad to change the files
So in total it probably isn't very prevalent. Thus, I think it is fine to throw an exception with a descriptive message. But please keep in mind that the users who are most likely to encounter this issue are the users who are the least technical (i.e. users that use the GUI, "weird" workflows and Notepad for editing files).
And by "as of now", you mean in current master or?
We should update the GUI to use the TRCFileAdapter (it uses an older pathway) and make it support reading these files. We have a 4.1 release coming up soon, but we're too close to the release to include it. We will look at this issue in a subsequent release, though. Thanks again for reporting!
@sebastianskejoe it seems that Notepad++ allows using a UTF-8 encoding without the byte order mark; https://stackoverflow.com/questions/32986445/remove-a-bom-character-in-a-file.
Can you check whether you're using the UTF-8
or UTF-8-BOM
encoding in Notepad++?
@chrisdembia yes, that was how I found out what the problem was, so as a workaround I converted the affected students' files to UTF8 using Notepad++. Again, for technical users this probably isn't a problem, but for users who haven't ever heard about UTF8 it might be a quite frustrating problem.