#!/bin/bash # htcharset.sh - Apache Encoding Helper # Author: Sean B. Palmer, inamidst.com # Write the appropriate .htaccess file for serving non-utf-8 files in the # directory $1 to stdout. CODE=~/web/inamidst.com/www/code echo '# The following was automatically generated by htcharset.sh' echo ${CODE}/charguess.py ${1%/}/* | egrep -v '^(ascii|utf-8)' | ( while true do read ENCODING FILENAME || break echo "" echo " AddDefaultCharset ${ENCODING%:}" echo '' echo done ) # [EOF]