<br><br><div class="gmail_quote">On Thu, Jun 25, 2009 at 2:33 AM, Alexander Belchenko <span dir="ltr"><<a href="mailto:bialix@ukr.net">bialix@ukr.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
In [1]: import shlex<br>
<br>
In [2]: shlex.split(r'foo C:/bar/spam')<br>
Out[2]: ['foo', 'C:/bar/spam']<br>
<br>
In [3]: shlex.split(r'foo C:\bar\spam')<br>
Out[3]: ['foo', 'C:barspam']<br>
<br>
This affects some plugins, but more important: it affects `bzr diff --using xxx`<br>
<br>
E.g. bzr diff --using "C:\Program Files\WinMerge\WinMergeU.exe" does not work, while bzr diff --using "C:/Program Files/WinMerge/WinMergeU.exe" does actually work.<br>
</blockquote><div><br>Yes. Some parts of bzr are more Win-friendly than others. This drove me crazy at first. Eventually I ended up escaping just about everything.<br> <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Instead of shlex.split should be used Win32 API CommandLineToArgvW() function (<a href="http://msdn.microsoft.com/en-us/library/bb776391%28VS.85%29.aspx" target="_blank">http://msdn.microsoft.com/en-us/library/bb776391(VS.85).aspx</a>)<br>
This function is already using in win32utils:get_unicode_argv() function.<br>
<br>
There is special function in commands.py<br>
<br>
def shlex_split_unicode(unsplit):<br>
import shlex<br>
return [u.decode('utf-8') for u in shlex.split(unsplit.encode('utf-8'))]<br>
<br>
<br>
So I think it should be platform dependent and use right method on win32. Right?<br>
<br>
Dear plugin writers! Please use the function shlex_split_unicode in your plugins and never shlex.split directly. So once someone will fix its behavior re backslashes your plugin will work much better on Windows.<br>
Thanks.</blockquote><div><br><br>It would be helpful to also add this advice to the Portability Tips in HACKING.txt. <br><br>-M<br><br></div></div>