# HG changeset patch # User Matthew Wild # Date 1603376842 -3600 # Node ID 07a0f9f2e69d95fd89be1e6f22c50276d67336c6 # Parent 9d7a293849f3d98986fd90bec9f604351c10896e libs.encodings: Add encodings.utf8 compat (works on Lua 5.3+) diff -r 9d7a293849f3 -r 07a0f9f2e69d libs/encodings.lua --- a/libs/encodings.lua Thu Oct 22 13:58:18 2020 +0100 +++ b/libs/encodings.lua Thu Oct 22 15:27:22 2020 +0100 @@ -9,5 +9,8 @@ idna = {}; stringprep = {}; base64 = { encode = mime.b64, decode = mime.unb64 }; +utf8 = { + valid = (utf8 and utf8.len) and function (s) return not not utf8.len(s); end or function () return true; end; +}; return _M;