views:

515

answers:

2

Hello,

When I execute the following command:

svnlook changed {path} -r {rev}

where {path} is the repository path and {rev} is the revision number, I get the following output:

U trunk/this/is/a/path/Mon fichier avec un nom accentu,.txt

The output should actually be:

U trunk/this/is/a/path/Mon fichier avec un nom accentué.txt

The "é" and other accentuated characters are not shown properly...

Is there any way for svnlook to output characters properly?

I know I can use "svn log" with the "--xml" option to get the proper encoding , but I need this for a pre-commit hook, and svn.exe can only get information from revisions, not transactions.

Thanks

A: 

You should try invoking this:

export LANG="fr_FR"

(or whatever Your developer's language is) before using svnlook. You can also set a default lang in Your shell start scripts, so You don't have to export it every time.

Reef
A: 

The issue you have here is that your pre-commit hook is run by the Subversion binary, which for security reasons passes an empty environment to the hook script. Among the things an empty environment does is remove any specific locale settings, reverting you to the system default (usually 'C' or something similar).

To get the correct output from svnlook, you need to restore the environment you care about before running it. If your script is bash, perhaps something like:

#!/bin/bash

export LANG="en_US.UTF-8"
export PATH="/bin:/usr/bin"

# Run svnlook here and get UTF-8 encoded output

In general, any locale with the '.UTF-8' suffix should be fine. Given that you appear to be a French speaker, the 'fr_FR.UTF-8' locale would be a reasonable setting.

David Anderson