diff --git a/wrapper/CSharp/wolfSSL_CSharp/wolfSSL.cs b/wrapper/CSharp/wolfSSL_CSharp/wolfSSL.cs index 2f8abda96..60f35afb3 100755 --- a/wrapper/CSharp/wolfSSL_CSharp/wolfSSL.cs +++ b/wrapper/CSharp/wolfSSL_CSharp/wolfSSL.cs @@ -564,7 +564,7 @@ namespace wolfSSL.CSharp { /// Read message from secure connection /// /// structure containing info about connection - /// object to hold incoming message + /// object to hold incoming message (Unicode format) /// size of available memory in buf /// amount of data read on success public static int read(IntPtr ssl, StringBuilder buf, int sz) @@ -616,7 +616,7 @@ namespace wolfSSL.CSharp { /// Read message from secure connection using a byte array /// /// structure containing info about connection - /// object to hold incoming message + /// object to hold incoming message (raw bytes) /// size of available memory in buf /// amount of data read on success public static int read(IntPtr ssl, byte[] buf, int sz) @@ -679,8 +679,8 @@ namespace wolfSSL.CSharp { } data = Marshal.AllocHGlobal(sz); - Marshal.Copy(System.Text.Encoding.UTF8.GetBytes(buf.ToString()), 0, - data, System.Text.Encoding.UTF8.GetByteCount(buf.ToString())); + Marshal.Copy(System.Text.Encoding.Default.GetBytes(buf.ToString()), 0, + data, System.Text.Encoding.Default.GetByteCount(buf.ToString())); ret = wolfSSL_write(sslCtx, data, sz); Marshal.FreeHGlobal(data); return ret;