From e6a5a9a5f79a00ff6645057b16f61666cabd9efc Mon Sep 17 00:00:00 2001 From: paul Date: Thu, 24 Nov 2016 14:35:59 +0000 Subject: [PATCH] 16bit linefeeds as specified in RFC svn path=/trunk/; revision=42 --- cgi.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cgi.sh b/cgi.sh index c366843..30e6d76 100755 --- a/cgi.sh +++ b/cgi.sh @@ -111,7 +111,8 @@ attribsafe(){ # except alphanumerig ascii printf %s "$*" \ - | hexdump -v -e '/1 "&#x%02X;"' \ + | iconv -f utf-8 -t utf32le \ + | hexdump -v -e '/4 "&#x%02X;"' \ | sed 's;0\;;0;g; s;1\;;1;g; s;2\;;2;g; s;3\;;3;g; s;4\;;4;g; s;5\;;5;g; s;6\;;6;g; s;7\;;7;g; s;8\;;8;g; s;9\;;9;g; s;A\;;A;g; s;B\;;B;g; s;C\;;C;g; s;D\;;D;g; s;E\;;E;g; s;F\;;F;g; @@ -127,7 +128,7 @@ attribsafe(){ } redirect(){ - printf '%s\n\n' "Location: $*" + printf '%s\r\n\r\n' "Location: $*" exit 0 } @@ -142,5 +143,5 @@ set_cookie(){ printf 'Set-Cookie: %s' "$cookie" [ -n "$expire" ] && printf '; Expires=%s' "$expire" [ $# -ge 3 ] && shift 2 && printf '; %s' "$@" - printf '\n' + printf '\r\n' } -- 2.39.2