Сейчас я использую bashlib, но тут (внезапно) оказалось, что оно ломает русский текст в post-запросах.
Собственно, вопроса два:
1) Есть ли другая подобная библиотека на bash? Мне нужно лишь парсить post/get запросы и cookies.
2) Как исправить этот баг в bashlib? Сейчас там вот такой код:
#
# get the name of the key, and decode it
#
name=${Q%%=*}
name=$(echo ${name} | \
sed -e 's/%\(\)/\\\x/g' | \
tr "+" " ")
name=$(echo ${name} | \
tr -d ".-")
name=$(printf ${name})
#
# get the value and decode it. This is tricky... printf chokes on
# hex values in the form \xNN when there is another hex-ish value
# (i.e., a-fA-F) immediately after the first two. My (horrible)
# solution is to put a space aftet the \xNN, give the value to
# printf, and then remove it.
#
tmpvalue=${Q#*=}
tmpvalue=$(echo ${tmpvalue} | \
sed -e 's/%\(..\)/\\\x\1 /g' | \
tr "+" " ")
#echo "Intermediate \$value: ${tmpvalue}" 1>&2
#
# Iterate through tmpvalue and printf each string, and append it to
# value
#
for i in "${tmpvalue}"; do
g=$(printf "${i}")
value="${value}${g}"
done
#value=$(echo ${value})
eval "export FORM_${name}='${value}'"