util/hex.lua
changeset 6805 442019e955dc
parent 6548 ec566d7cd518
child 12359 a0ff5c438e9d
--- a/util/hex.lua	Wed Aug 26 13:17:10 2015 +0200
+++ b/util/hex.lua	Wed Aug 26 14:32:20 2015 +0200
@@ -1,6 +1,7 @@
 local s_char = string.char;
 local s_format = string.format;
 local s_gsub = string.gsub;
+local s_lower = string.lower;
 
 local char_to_hex = {};
 local hex_to_char = {};
@@ -19,7 +20,7 @@
 end
 
 local function from(s)
-	return (s_gsub(s, "..", hex_to_char));
+	return (s_gsub(s_lower(s), "%X*(%x%x)%X*", hex_to_char));
 end
 
 return { to = to, from = from }