X-Git-Url: http://git.sthu.org/?a=blobdiff_plain;f=gpg-mailkeys%2Fgpg-mailkeys;h=7ba5139dfe6decf69a12ba012a8179561bd5cb5e;hb=17fd91ece11d3f5a25cf01dd1624f71440eb08f5;hp=cacaf1dfac3637ac23b29c69ce1f8341d085e063;hpb=d1eca2bf49b2826a992140a00ee2c2817e584d8f;p=pgp-tools.git diff --git a/gpg-mailkeys/gpg-mailkeys b/gpg-mailkeys/gpg-mailkeys index cacaf1d..7ba5139 100755 --- a/gpg-mailkeys/gpg-mailkeys +++ b/gpg-mailkeys/gpg-mailkeys @@ -8,6 +8,33 @@ set -e VERSION='$Rev$' +# Define the charset used in the text message of the mail +LOCAL_CHARSET="" + +## +# Get the local charset. +# +# The local charset is deduced from the charset used by both ~/.gpg-mailkeysrc +# and ~/.signature. If none of these files exist, the local charset is assumed +# to be us-ascii. + +get_local_charset () +{ + local charset="us-ascii" + local file_list="$HOME/.signature $HOME/.gpg-mailkeysrc" + + for filename in $file_list; do + + if [ -e $filename ]; then + charset=`file --mime-encoding $filename | cut -d ' ' -f 2` + break + fi + + done; + + LOCAL_CHARSET=$charset +} + if [ -z "$*" ]; then printf "Send people their newly signed GPG key by mail.\n" printf "Usage: $0 keyid ...\n" @@ -35,6 +62,8 @@ Enjoy, $NAME" fi +get_local_charset + FAILKEYS= while [ -n "$1" ]; do @@ -66,18 +95,18 @@ Content-Disposition: inline --$BOUNDARY -Content-Type: text/plain; charset=us-ascii +Content-Type: text/plain; charset=$LOCAL_CHARSET Content-Disposition: inline Content-Transfer-Encoding: quoted-printable -$TEXT +`echo "$TEXT" | qprint -e` EOM if [ -f ~/.signature ]; then printf -- "--=20\n" >> $TEMPFILE - cat ~/.signature >> $TEMPFILE + qprint -e ~/.signature >> $TEMPFILE fi cat << EOM >> $TEMPFILE