# 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;
}
redirect(){
- printf '%s\n\n' "Location: $*"
+ printf '%s\r\n\r\n' "Location: $*"
exit 0
}
printf 'Set-Cookie: %s' "$cookie"
[ -n "$expire" ] && printf '; Expires=%s' "$expire"
[ $# -ge 3 ] && shift 2 && printf '; %s' "$@"
- printf '\n'
+ printf '\r\n'
}