+# 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
+}
+