+commit_msg () {
+ # String "initial. initial" partly in German (translated with Google Translate),
+ # encoded in UTF-8, used as a commit log message below.
+ msg=$(printf "initial. anf\303\244nglich")
+ if test -n "$1"
+ then
+ msg=$(echo $msg | iconv -f utf-8 -t $1)
+ fi
+ if test -n "$2" -a -n "$3"
+ then
+ # cut string, replace cut part with two dots
+ # $2 - chars count from the beginning of the string
+ # $3 - "trailing" chars
+ # LC_ALL is set to make `sed` interpret "." as a UTF-8 char not a byte
+ # as it does with C locale
+ msg=$(echo $msg | LC_ALL=en_US.UTF-8 sed -e "s/^\(.\{$2\}\)$3/\1../")
+ fi
+ echo $msg
+}
+