[Svnmerge] Encoding problem in svnmerge commit message file

Raman Gupta rocketraman at fastmail.fm
Mon Dec 31 09:50:21 PST 2007


Romulo A. Ceccon wrote:
> On Dec 7, 2007 11:19 PM, Raman Gupta <rocketraman at fastmail.fm> wrote:
>> It would be really helpful if you could create a test in
>> svnmerge_test.py. That would make it easier for people to test this
>> cross-platform.
> 
> Ok. The patch is attached.
> 
> Note that I had to change TestCase_SvnMerge.svnmerge to use a
> different StringIO object, since it replaces sys.stdout with a version
> which doesn't provide the "encoding" property. That property is
> required by svnmerge.py in my proposed patch.

Awesome, thanks for the test case!

Note that the patch causes 13 tests to fail on my machine. I believe
the reason is that svnmerge.py currently sets os.environ["LC_ALL"] =
"C" and that, at least on my machine, causes
locale.getdefaultlocale()[1] to return None, which then causes the
call to encode to fail:

Python 2.5.1 (r251:54863, Oct 30 2007, 13:45:26)
[GCC 4.1.2 20070925 (Red Hat 4.1.2-33)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os, locale
>>> locale.getdefaultlocale()[1]
'UTF8'
>>> locale.setlocale(locale.LC_ALL, '')
'en_US.UTF-8'
>>> locale.getdefaultlocale()[1]
'UTF8'
>>> locale.setlocale(locale.LC_ALL, 'C')
'C'
>>> locale.getdefaultlocale()[1]
'UTF8'
>>> os.environ["LC_ALL"] = "C"
>>> locale.getdefaultlocale()[1]
>>>

So it seems to be specifically the os.environ setting (added in rev
23305) that is causing problems on my machine, whereas the
"equivalent" python call to setlocale 'C' is ok. I think os.environ is
needed for svn though, so... anybody out there that understands what
is going on?

Cheers,
Raman Gupta



More information about the Svnmerge mailing list