문제

I'm using Python script to implement SVN pre-commit hook:

svnlookPath = 'path-to-svnlook'

f = subprocess.Popen([svnlookPath, 'log', sys.argv[1], '--transaction', sys.argv[2]], stdout=subprocess.PIPE).stdout
commitMessage = f.read()
f.close()
commitMessage = commitMessage.rstrip('\n\r')

print >> sys.stderr, 'Commit message: "' + commitMessage + '"'
sys.exit(1)

My pre-commit.bat (server is hosted on Windows Server 2008):

@python.exe path-to-py-file %1 %2

On a client side I use TortoiseSVN.

Everything goes ok, except commit message encoding. If the commit message contains, for example, Russian letters they are shown as '?' (question marks) in Tortoise window.

도움이 되었습니까?

해결책

I would say this is more the fault of the .bat then of the python script, because python has excellent unicode support.
Perhaps the answer of this question can help you.

Batch file encoding

다른 팁

The problem could be Tortoise itself. Try the following

svn log http://rev_url

and see what svn says the log comment is. If it gets it right, then its probably Tortoise not showing the Russian encoding. What happens if you commit without your pre-commit hook? Does that show correctly?

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top