From 6f44f8382a7dad77c42d53193701ae8e49beb214 Mon Sep 17 00:00:00 2001 From: "Ryan M. Moore" Date: Mon, 30 Dec 2024 22:00:57 -0500 Subject: Fix non-character handling in `string.utf_codepoint` Treats `U+FFFE` and `U+FFFF` as valid Unicode codepoints rather than errors. See #778. --- src/gleam/string.gleam | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/gleam/string.gleam b/src/gleam/string.gleam index 8802f09..fd43b29 100644 --- a/src/gleam/string.gleam +++ b/src/gleam/string.gleam @@ -809,7 +809,6 @@ pub fn from_utf_codepoints(utf_codepoints: List(UtfCodepoint)) -> String pub fn utf_codepoint(value: Int) -> Result(UtfCodepoint, Nil) { case value { i if i > 1_114_111 -> Error(Nil) - 65_534 | 65_535 -> Error(Nil) i if i >= 55_296 && i <= 57_343 -> Error(Nil) i if i < 0 -> Error(Nil) i -> Ok(unsafe_int_to_utf_codepoint(i)) -- cgit v1.2.3