Readlines() output format

I have tried to read lines from text file filename.ixc using readlines() function

readlines("filename.ixc")

and I have got strange output format.

In vscode I can see the file content as plaintext, a few lines follow

[SETUP]
SPEED_RES_ASPECT_PRIORITY_MODE=PRIORITY_RESOLUTION
CAMERA_SPEED=SPEED_16
FRAME_SPEED=232142
RESOLUTION_X=150
RESOLUTION_Y=150
FRAME_SIZE=22500
ASPECT_RATIO_MODE=ASPECT_RATIO_FULL
SHUTTER_TIME=1000

In the output I got

“\0[\0S\0E\0T\0U\0P\0]\0\r\0”
“\0S\0P\0E\0E\0D\0_\0R\0E\0S\0_\0A\0S\0P\0E\0C\0T\0_\0P\0R\0I\0O\0R\0I\0T\0Y\0_\0M\0O\0D\0E\0=\0P\0R\0I\0O\0R\0I\0T\0Y\0_\0R\0E\0S\0O\0L\0U\0T\0I\0O\0N\0\r\0”
“\0C\0A\0M\0E\0R\0A\0_\0S\0P\0E\0E\0D\0=\0S\0P\0E\0E\0D\0_\x001\x006\0\r\0”
“\0F\0R\0A\0M\0E\0_\0S\0P\0E\0E\0D\0=\x002\x003\x002\x001\x004\x002\0\r\0”
“\0R\0E\0S\0O\0L\0U\0T\0I\0O\0N\0_\0X\0=\x001\x005\x000\0\r\0”
“\0R\0E\0S\0O\0L\0U\0T\0I\0O\0N\0_\0Y\0=\x001\x005\x000\0\r\0”
“\0F\0R\0A\0M\0E\0_\0S\0I\0Z\0E\0=\x002\x002\x005\x000\x000\0\r\0”
“\0A\0S\0P\0E\0C\0T\0_\0R\0A\0T\0I\0O\0_\0M\0O\0D\0E\0=\0A\0S\0P\0E\0C\0T\0_\0R\0A\0T\0I\0O\0_\0F\0U\0L\0L\0\r\0”
“\0S\0H\0U\0T\0T\0E\0R\0_\0T\0I\0M\0E\0=\x001\x000\x000\x000\0\r\0”
“\0A\0C\0H\0I\0E\0V\0E\0D\0_\0S\0H\0U\0T\0T\0E\0R\0_\0T\0I\0M\0E\0=\x001\x000\x005\08\0\r\0”
“\0D\0I\0G\0I\0T\0A\0L\0_\0G\0A\0I\0N\0_\0M\0O\0D\0E\0=\0G\0A\0I\0N\0_\0O\0F\0F\0\r\0”

Please do you have any idea how to read it properly?

It looks like the file is UTF-16 encoded. You can use https://github.com/JuliaStrings/StringEncodings.jl to read it.

4 Likes

Thank you very much. Solution was straightforward.

using StringEncodings

readlines("filename.ixc" , enc"UTF-16")
3 Likes