Problem with packing and unpacking data in Bin2* and *2Bin functions
Posted: Thu Jul 30, 2020 7:53 am
Hi,
While debugging the converted VO application, I found a difference in the way of converting strings between a group of functions like Mem2String, StringAlloc, etc. on the one hand, and Bin2_, _2Bin on the other. As we know, strings in NET are Unicode, and in VO they are ANSI. XSharp (as I saw from the source code in XSharpPublic) uses Windows code page (Encoding (WinCodePage)) string transformations for consistent behavior. But it is used only in the set of functions Mem2String, StringAlloc, etc. And the Bin2_, _2Bin function set uses a different approach - an attempt to store the original byte value in Unicode strings. As a result, it turns out that these functions work correctly within their sets, but not among themselves. And this leads to the inoperability of the VO application, where all these functions were compatible.
At the same time, as I understand it, these functions came from VO and should provide compatibility in a VO application. After all, if we are talking about a NET application, then there is a huge selection of tools for such operations: BitConverter, System.Text.Encoding, Marshal.StringToHGlobalAnsi, etc.
Need some advice on how to work around this issue in XSharp in a converted VO application now. Will there be any changes in Runtime related to these?
Best regards,
Leonid
While debugging the converted VO application, I found a difference in the way of converting strings between a group of functions like Mem2String, StringAlloc, etc. on the one hand, and Bin2_, _2Bin on the other. As we know, strings in NET are Unicode, and in VO they are ANSI. XSharp (as I saw from the source code in XSharpPublic) uses Windows code page (Encoding (WinCodePage)) string transformations for consistent behavior. But it is used only in the set of functions Mem2String, StringAlloc, etc. And the Bin2_, _2Bin function set uses a different approach - an attempt to store the original byte value in Unicode strings. As a result, it turns out that these functions work correctly within their sets, but not among themselves. And this leads to the inoperability of the VO application, where all these functions were compatible.
At the same time, as I understand it, these functions came from VO and should provide compatibility in a VO application. After all, if we are talking about a NET application, then there is a huge selection of tools for such operations: BitConverter, System.Text.Encoding, Marshal.StringToHGlobalAnsi, etc.
Need some advice on how to work around this issue in XSharp in a converted VO application now. Will there be any changes in Runtime related to these?
Best regards,
Leonid