[MERGE] Running bzr from vim scripts gives 'unknown encoding warning'
Martin Pool
mbp at canonical.com
Tue May 6 00:56:55 BST 2008
On Tue, May 6, 2008 at 5:50 AM, John Arbash Meinel
<john at arbash-meinel.com> wrote:
> Neil Martinsen-Burrell wrote:
> | I'm trying out the Bazaar integration in Vim using VCSCommand and
> | vcsbzr.vim and I was getting the message
> |
> | """
> | bzr: warning: unknown encoding . Continuing with ascii encoding.
> | """
> |
> | before every command's output. For whatever reason, with Vim 7.0 on Mac
> | OS X 10.5.2, python was returning '' for locale.getpreferredencoding()
> | which is not a valid codec, so we got the 'unknown encoding warning'.
> | For such a non-informative encoding as '', I think we should just assume
> | (as we do for None and 'cp0') that we should use ascii encoding and not
> | complain (as the attached patch does).
> |
> | A more philosophically appealing fix would be to find out what encoding
> | vim wants and find out why that information isn't being passed on to the
> | python subprocess and fix that underlying problem. I have chosen an
> | easier and less satisfying solution.
>
> Well, I actually think it is kind of nice to get this warning since then
> you can make sure your script does something like "LANG=C bzr" or "LANG=en.UTF-8
> bzr".
My impression is that he is not setting it but rather inheriting the
setting from his environment. Presumably it is set correctly at at
least the login level and there is a bug somewhere in the os, vim, the
script, python, or bzr.
Neil since you can reproduce this could you find out what bzr thinks
the locale is? (by e.g. printing locale.getlocale() in this message.)
That might tell us more about where the problem is.
> At least, that would be my recommendation.
> I'm not opposed to your patch, but it might be hiding something that would
> actually make it work *correctly* with vim.
So if we merge this, we might get a bug in future that non-ascii diffs
don't work properly under vim on osx. Generally we don't want to
sweep this bug under the covers. On the other hand it seems quite
possibly a vim or vim script bug not ours. If we are asked to use the
locale '' ascii may be the most reasonable interpretation.
--
Martin <http://launchpad.net/~mbp/>
More information about the bazaar
mailing list