[darcs-users] darcs patch: Remove home-grown UTF-8 decoder, use utf... (and 1 more)

Petr Rockai me at mornfall.net
Sun Sep 6 13:28:11 UTC 2009


Reinier Lamers <tux_rocker at reinier.de> writes:

Fix locale switching in emailformat.sh test
-------------------------------------------

> Reinier Lamers <tux_rocker at reinier.de>**20090906111406
> hunk ./tests/emailformat.sh 7
>  
>  set -ev
>  # TODO: is this really enough to make all commands interpret the given strings 
> -# as latin1?
> -export LANG="en_US.ISO-8859-1"
> +# as latin9?
> +latin9_locale=`locale -a | grep @euro | head -n 1`
> +if [ -z $latin9_locale ]; then
> +        echo "no latin9 locale found"
> +        exit 200 # skip, we can't switch away from UTF-8
> +fi
> +
> +echo "Using locale $latin9_locale"
> +export LC_ALL=$latin9_locale
> +echo "character encoding is now `locale charmap`"
>  
>  rm -rf temp1
>  rm -rf temp2
I'm not sure, but I'd guess that the "locale" command is not available at least
on Windows, but its manpage doesn't mention it being part of POSIX and instead
says it was written for glibc, which may be a further portability problem. I'd
suggest doing a

if which locale; then
   latin9_locale=latin9_locale=`locale -a | grep @euro | head -n 1`
else
   latin9_locale=en_US.ISO-8859-1
fi

or if it is really required, exit 200 in the else branch.

> Context:
PS: You too may want to run optimize --reorder on the repository you are
sending from, to reduce the amount of context included. It may also make sense
to reduce the contexts automatically without requiring people to run optimize
--reorder. Hard to tell.


More information about the darcs-users mailing list