4

I created a svn hook that calls a php script to send some emails. The problem is that I am getting incorrect encoded msg's (I think that's what 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 this:

Modified files - /base/view.php

Mais umas actualizações

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

Anyone know what I can use/do to correct this?
Thanks

AntonioCS
  • 8,335
  • 18
  • 63
  • 92
  • It would be helpful if you pasted the relevant portions of both your hook and the PHP script. – Steven Richards Feb 07 '10 at 04:12
  • It would also be helpful if you posted a hex dump of the two emails--a missing/extra byte would certainly help people figure things out. – JXG Feb 07 '10 at 09:49
  • @JXG How can I get a hex dump from a gmail mail? – AntonioCS Feb 07 '10 at 18:03
  • I don't really know. What you can do, though, is click on the down arrow (next to "Reply") and choose "Show original." This will show (IIUC) the actual transmission of the email. In my multi-lang email, I see "Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: base64" -- you should probably see something similar. I think I was wrong about a hex dump, but a base64 comparison would also help. Also try to see if you get the same problem in non-gmail mail. – JXG Feb 08 '10 at 07:22
  • * What happens when you run your php script separately from the hook? Do you still have those encoding issues? * Have you tried running your hook script from the command line? Do you still have the same types of encoding issues? – David W. Jul 26 '10 at 02:43

2 Answers2

4

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

(in post-commit, before the call to your script)

export LANG="fr_FR.UTF-8"

Of course, you might adjust to the locale you need, as long as it's utf8.

Bertrand Gorge
  • 384
  • 1
  • 3
  • 16
0

It probably has to do with the locale of the executing environment. When you run it yourself it's in your locale, and probably handles the special characters correctly.

I suspect the hook gets executed in the subversion servers locale, which may be the 'C' locale or some locale that doesn't know how to handle those characters.

John Weldon
  • 39,849
  • 11
  • 94
  • 127