diff --git a/SDL3-CS.Tests/Program.cs b/SDL3-CS.Tests/Program.cs index d8db8dc..3eeccb8 100644 --- a/SDL3-CS.Tests/Program.cs +++ b/SDL3-CS.Tests/Program.cs @@ -14,19 +14,6 @@ namespace SDL3.Tests { Console.OutputEncoding = Encoding.UTF8; - unsafe - { - // Encoding.UTF8.GetBytes can churn out null pointers and doesn't guarantee null termination - fixed (byte* badPointer = Encoding.UTF8.GetBytes("")) - Debug.Assert(badPointer == null); - - fixed (byte* pointer = UTF8GetBytes("")) - { - Debug.Assert(pointer != null); - Debug.Assert(pointer[0] == '\0'); - } - } - SDL_SetHint(SDL_HINT_WINDOWS_CLOSE_ON_ALT_F4, "null byte \0 in string"u8); Debug.Assert(SDL_GetHint(SDL_HINT_WINDOWS_CLOSE_ON_ALT_F4) == "null byte "); diff --git a/SDL3-CS/SDL3.cs b/SDL3-CS/SDL3.cs index bf00f9f..6aed6af 100644 --- a/SDL3-CS/SDL3.cs +++ b/SDL3-CS/SDL3.cs @@ -27,17 +27,5 @@ namespace SDL return s; } - - /// - /// UTF8 encodes a managed string to a byte array suitable for use in ReadOnlySpan<byte> parameters of SDL functions. - /// - /// The string to encode. - /// A null-terminated byte array. - public static byte[] UTF8GetBytes(string s) - { - byte[] array = Encoding.UTF8.GetBytes(s + '\0'); - Debug.Assert(array[^1] == '\0'); - return array; - } } }