default fsenc patch

INADA Naoki songofacandy at gmail.com
Wed Jan 25 01:49:25 UTC 2012


On Wed, Jan 25, 2012 at 9:51 AM, Martin Pool <mbp at canonical.com> wrote:
> On 24 January 2012 20:14, INADA Naoki <songofacandy at gmail.com> wrote:
>> I sometimes use bzr on Linux without locale. I can write non-ascii comment with
>> vim but bzr doesn't accept it.
>
> I guess if you do set the locale it will be ok?

"Set the locale" is not easy for me. Our server is built minimal way
to boot from network
and don't have any locale.

$ locale
LANG=
LC_CTYPE="POSIX"
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"
LC_ALL=
$ export LANG=en_US.utf8
$ locale
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_US.utf8
LC_CTYPE="en_US.utf8"
LC_NUMERIC="en_US.utf8"
LC_TIME="en_US.utf8"
LC_COLLATE="en_US.utf8"
LC_MONETARY="en_US.utf8"
LC_MESSAGES="en_US.utf8"
LC_PAPER="en_US.utf8"
LC_NAME="en_US.utf8"
LC_ADDRESS="en_US.utf8"
LC_TELEPHONE="en_US.utf8"
LC_MEASUREMENT="en_US.utf8"
LC_IDENTIFICATION="en_US.utf8"
LC_ALL=
$ python
Python 2.7.2 (default, Aug 18 2011, 15:38:34)
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import locale
>>> locale.getpreferredencoding()
'ANSI_X3.4-1968'
>>>

>
>> I think get_user_encoding() should also be 'utf-8' by default.
>> At least, bzr should provide a way to override user encoding. (e.g.
>> BZR_USER_ENCODING envvar)
>
> I think we can do that (there may be a bug for it).  For filenames it
> is harder to override what Python thinks the encoding ought to be.

OK, I'll write patch and send merge request before 2.5rc1.
Supporting utf8 filename and commit message on machine without locale
is very nice to me.

>
> vim apparently also has some issues with non-locale-encoded filenames
> <http://comments.gmane.org/gmane.editors.vim.devel/28508>.
>
> There are more dimensions on which people may want to vary (or have to
> vary) than Unix's concept of locale can really capture: you might want
> to write your commit message in utf-8, have filenames in euc, and have
> the text interface just run in C...  But, even beyond just needing to
> implement those variations, we are a bit constrained what Python will
> actually let us implement.
>
> Anyhow, on the specific thing of this patch, of defaulting to utf-8,
> if gz feels we should leave it in, that's ok with me.  It should only
> be active in fairly edge cases of having non-ascii names and an
> explicitly or implicitly ascii locale.
>
> --
> Martin

-- 
INADA Naoki  <songofacandy at gmail.com>



More information about the bazaar mailing list