summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam S Fulton <wsf@fultondesigns.co.uk>2022-09-22 18:54:49 +0100
committerWilliam S Fulton <wsf@fultondesigns.co.uk>2022-09-22 18:54:49 +0100
commiteaf468e9e8d3ef17f397ef6bc5e73807a2bf3594 (patch)
tree36e65fe2fabbbb41f5fe21c266d68aa1d4f28927
parentfa00622614d35716b429b12aa9dc1bde8e4b586d (diff)
downloadswig-eaf468e9e8d3ef17f397ef6bc5e73807a2bf3594.tar.gz
C# CreateWStringFromUTF32 optimisation
Avoid UTF-32 to UTF-8 conversion then get string from UTF-8 Issue #2369
-rw-r--r--Lib/csharp/wchar.i3
1 files changed, 1 insertions, 2 deletions
diff --git a/Lib/csharp/wchar.i b/Lib/csharp/wchar.i
index 2ada4df75..39b99ee22 100644
--- a/Lib/csharp/wchar.i
+++ b/Lib/csharp/wchar.i
@@ -49,8 +49,7 @@ static void * SWIG_csharp_wstring_callback(const wchar_t *s) {
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 SWIGWStringHelper() {