Svn hook encoding issue

I created an svn binding that calls a PHP script to send some emails. The problem is that I get the wrong encoded msg (I think you can call it)

This is what I get in my mail:

Modified files - / base / view.php

Mais umas actualiza? \ 195? \ 167? \ 195? \ 181es

This is what I get when the hook calls the script. But if I call the script directly (specifying the revision), I get the following:

Modified files - / base / view.php

Mais umas actualizações

Mail is sent with the encoding iso-8859-1 (I tried utf-8 and got the same results)

Does anyone know what I can use / do to fix this?
Thanks

+4
source share
2 answers

You need to export LANG to a post-commit hook, otherwise svnlook will output the log to the locale set for your SVN user:

(in post-commit, before calling your script)

export LANG = "fr_FR.UTF-8"

Of course, you can adapt to the language you need if it is utf8.

+4
source

This is probably due to the locale of the runtime. When you run it yourself in your locale and probably handle special characters correctly.

I suspect that the hook is triggering on the subversion server locale, which may be the 'C' locale or some locale that does not know how to handle these characters.

0
source

Source: https://habr.com/ru/post/1300506/


All Articles