From 26f9a3caa7d9046a92878027e5bb978012173ec9 Mon Sep 17 00:00:00 2001 From: Kip Cole Date: Fri, 10 Nov 2023 14:16:01 +1100 Subject: [PATCH] Guard on the encoding --- lib/unicode.ex | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/unicode.ex b/lib/unicode.ex index b3db1e8..0f9dde0 100644 --- a/lib/unicode.ex +++ b/lib/unicode.ex @@ -114,7 +114,8 @@ defmodule Unicode do end end - def replace_invalid(binary, encoding, replacement) do + def replace_invalid(binary, encoding, replacement) + when encoding in [:utf8, :utf16, :utf16be, :utf16le, :utf32, :utf32be, :utf32le] do Unicode.Validation.replace_invalid(binary, encoding, replacement) end