Browse Source

Added support for UTF8 string encoding marshaling.

pull/974/head
Joao Matos 8 years ago
parent
commit
688b09f8f1
  1. 3
      src/Generator/Generators/CSharp/CSharpMarshal.cs

3
src/Generator/Generators/CSharp/CSharpMarshal.cs

@ -214,6 +214,9 @@ namespace CppSharp.Generators.CSharp @@ -214,6 +214,9 @@ namespace CppSharp.Generators.CSharp
if (Equals(encoding, Encoding.ASCII))
return $"Marshal.PtrToStringAnsi({varName})";
if (Equals(encoding, Encoding.UTF8))
return $"Marshal.PtrToStringUTF8({varName})";
// If we reach this, we know the string is Unicode.
if (type.Type == PrimitiveType.Char ||
Context.Context.TargetInfo.WCharWidth == 16)

Loading…
Cancel
Save