corert
corert copied to clipboard
Support correct ANSI marshaling semantics
https://github.com/dotnet/corert/blob/master/src/System.Private.CoreLib/src/Internal/Runtime/CompilerHelpers/InteropHelpers.cs
internal static unsafe byte[] StringToAnsi(String str)
{
if (str == null)
return null;
// CORERT-TODO: Use same encoding as the rest of the interop
var encoding = Encoding.UTF8;
It needs to account for ANSI in Windows.
Also, it would be nice for it to allocate on stack for small strings... .
Fixed in https://github.com/dotnet/corert/pull/3315