I agree that there is no documentation. Without proper documentation, we are programming by coincidence . marshal_as can be very useful, but when I get a question that wasn’t answered in the documentation, I just skip it and do it in a few steps. Someone may have an exact answer about how marshal_as works in each case, but if you do not add it to your code as a comment, the next programmer is not going to think about this problem or understand it even after checking the documentation.
BCL is very capable of character conversion. I suggest using the Encoding member for GetBytes and then copying them into the string structure / string class of C or C ++. Despite the fact that more steps are required, then it is clear which character sets and encodings you use, how the inconsistencies are handled, how ownership of the string is transferred, and how it should be destroyed. (Mismatches, of course, do not apply when converting between UTF-16 and UTF-8.)
Tom Blodget Sep 20 '13 at 3:12 2013-09-20 03:12
source share