Diff

util/format.lua @ 12220:25b853e64d83

util.format: Skip control code escaping when doing full serialization Fixes that a multi-line string ended up "like\ \9this" instead of "like\nthis" as can be demonstrated by somehow initiating a connection to a HTTP server.
author Kim Alvefur <zash@zash.se>
date Thu, 27 Jan 2022 21:14:22 +0100
parent 12040:337b489532b7
child 12221:056b7920b686
line wrap: on
line diff
--- a/util/format.lua	Thu Jan 27 16:23:26 2022 +0100
+++ b/util/format.lua	Thu Jan 27 21:14:22 2022 +0100
@@ -108,7 +108,7 @@
 		if t == "string" and option ~= "p" then
 			if not valid_utf8(arg) then
 				option = "q";
-			else
+			elseif option ~= "q" then -- gets fully escaped in the next block
 				args[i] = arg:gsub("[%z\1-\8\11-\31\127]", control_symbols):gsub("\n\t?", "\n\t");
 				return spec;
 			end