C# CreateWStringFromUTF32 optimisation
Avoid UTF-32 to UTF-8 conversion then get string from UTF-8 Issue #2369
This commit is contained in:
parent
fa00622614
commit
eaf468e9e8
1 changed files with 1 additions and 2 deletions
|
|
@ -49,8 +49,7 @@ static void * SWIG_csharp_wstring_callback(const wchar_t *s) {
|
||||||
|
|
||||||
byte[] buffer = new byte[length * 4];
|
byte[] buffer = new byte[length * 4];
|
||||||
global::System.Runtime.InteropServices.Marshal.Copy(cString, buffer, 0, buffer.Length);
|
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.UTF32.GetString(buffer);
|
||||||
return global::System.Text.Encoding.Default.GetString(utf8buffer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static SWIGWStringHelper() {
|
static SWIGWStringHelper() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue