Closed pkese closed 2 years ago
As the name says PtrToStringAnsi reads the string as Ansi but we need to treat them as Utf8
You're right, sorry about that.
PtrToStringAnsi
does the correct thing on Linux (converts from Utf8), but on Windows it treats bytes according to system codepage.
There's a better fitting PtrToStringUTF8
but unfortunately it's not part of netstandard.
It's part of netstandard2.1 but not 2.0
I've added a switch to netstandard 2.1 and fixed the marshal call.
It's up to you to decide if this small change is worth considering the switch of the whole project to target netstandard 2.1.
I want to keep 2.0 for now.
Sure.
Marshal.PtrToStringAnsi
does the same as what we were doing manually,but without extra allocation for
byteArray
.