Better unicode conversion

This commit is contained in:
2024-11-05 12:39:14 +02:00
parent a0563074ed
commit d5da9ac62d
2 changed files with 18 additions and 18 deletions

View File

@@ -6,7 +6,7 @@ import "testing"
func TestEnsureValidUTF8(t *testing.T) {
// Create a string with a null byte
strWithNull := "Hello" + string('\x00') + "world"
result, _ := EnsureValidUTF8([]byte(strWithNull))
result, _ := BytesToValidUTF8([]byte(strWithNull))
if result != "Helloworld" {
t.Errorf("Expected string without NULL byte, got %s", result)
}