views:

43

answers:

1

I have a legacy Delphi COM library that accepts an ANSI string (code page 1252) as parameter.
The generated .net wrapper accepts a string for this parameter. Passing in a regular string however doesn't end well. If passed in the '°' character a question mark takes up it's spot.

How can I go and debug this? Is it the com wrapper not recognising the correct encoding? How can I pass in an ANSI string (I can convert it to bytes, but the API requires a string, so it is converted to UTF16 again)

A: 

One workaround would be to write an intermediate layer in an unmanaged language that would redirect calls to the original library and use MultiByteToWideChar for conversion. That's quite easy and a good solution if you don't convince the wrapper some other way.

sharptooth
What I'm wondering though is why the wrapper isn't wrapping correctly..
borisCallens