[Svnmerge] Encoding problem in svnmerge commit message file
Raman Gupta
rocketraman at fastmail.fm
Tue Feb 19 15:07:05 PST 2008
Raman Gupta wrote:
> 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?
I spoke to Daniel Shahaf on #svn, and I got a slightly better
understanding of svn behavior related to LC_ALL and commit log messages.
The attached patch is a slightly modified version of Romulo's that,
allows svnmerge.py and svn to use the locale set by the user's
environment, instead of trying to use the 'C' locale.
Could everyone (especially people in non-english locations) test it
and verify it works in their environment?
Cheers,
Raman Gupta
-------------- next part --------------
A non-text attachment was scrubbed...
Name: svnmerge_encoding_new.patch
Type: text/x-patch
Size: 5376 bytes
Desc: not available
URL: </pipermail/svnmerge/attachments/20080219/dbefe906/attachment-0002.bin>
More information about the Svnmerge
mailing list