diff options
author | William S Fulton <wsf@fultondesigns.co.uk> | 2022-09-30 23:21:39 +0100 |
---|---|---|
committer | William S Fulton <wsf@fultondesigns.co.uk> | 2022-09-30 23:21:39 +0100 |
commit | 929cfde883eac37bf2c2f439a0d9163dcf570376 (patch) | |
tree | daac9a36694252b0a5f2645eceb108d914388e4a /Lib | |
parent | e147f2af69dac2d4085a55fc9a12532639b990c4 (diff) | |
download | swig-929cfde883eac37bf2c2f439a0d9163dcf570376.tar.gz |
C# CreateWStringFromUTF32 optimisation
Avoid UTF-32 to UTF-8 conversion then get string from UTF-8
Missing change that should have gone into eaf468e9e8d3ef17f397ef6bc5e73807a2bf3594
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/csharp/wchar.i | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/Lib/csharp/wchar.i b/Lib/csharp/wchar.i index 39b99ee22..f1e0d5a26 100644 --- a/Lib/csharp/wchar.i +++ b/Lib/csharp/wchar.i @@ -101,9 +101,7 @@ static SWIG_CSharpWStringExceptionHelperCallback SWIG_csharp_ApplicationExceptio return string.Empty; byte[] buffer = new byte[length * 4]; - global::System.Runtime.InteropServices.Marshal.Copy(cString, buffer, 0, buffer.Length); - byte[] utf8buffer = global::System.Text.Encoding.Convert(global::System.Text.Encoding.UTF32, global::System.Text.Encoding.UTF8, buffer); - return global::System.Text.Encoding.Default.GetString(utf8buffer); + return global::System.Text.Encoding.UTF32.GetString(buffer); } static void SetPendingApplicationExceptionUTF16([global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]global::System.IntPtr cString, int length) { |