From: david-sarah Date: Wed, 9 Jun 2010 00:08:03 +0000 (-0700) Subject: Back out Windows-specific Unicode argument support for v1.7. X-Git-Url: https://git.rkrishnan.org/vdrive/%22news.html/module-simplejson.tests.html?a=commitdiff_plain;h=32d9deace3d82637f08e58c73c314bc5cfe53c80;p=tahoe-lafs%2Ftahoe-lafs.git Back out Windows-specific Unicode argument support for v1.7. --- diff --git a/src/allmydata/test/test_stringutils.py b/src/allmydata/test/test_stringutils.py index a4095c84..413eae88 100644 --- a/src/allmydata/test/test_stringutils.py +++ b/src/allmydata/test/test_stringutils.py @@ -27,7 +27,7 @@ if __name__ == "__main__": print " platform = '%s'" % sys.platform print " filesystem_encoding = '%s'" % sys.getfilesystemencoding() print " output_encoding = '%s'" % sys.stdout.encoding - print " argv_encoding = '%s'" % (sys.platform == "win32" and 'utf-8' or sys.stdout.encoding) + print " argv_encoding = '%s'" % (sys.platform == "win32" and 'ascii' or sys.stdout.encoding) try: tmpdir = tempfile.mkdtemp() @@ -272,31 +272,28 @@ class UbuntuKarmicLatin1(StringUtils, unittest.TestCase): class WindowsXP(StringUtils, unittest.TestCase): uname = 'Windows XP 5.1.2600 x86 x86 Family 15 Model 75 Step ping 2, AuthenticAMD' output = 'lumi\x8are' - argv = 'lumi\xc3\xa8re' platform = 'win32' filesystem_encoding = 'mbcs' output_encoding = 'cp850' - argv_encoding = 'utf-8' + argv_encoding = 'ascii' dirlist = [u'Blah blah.txt', u'test_file', u'\xc4rtonwall.mp3'] class WindowsXP_UTF8(StringUtils, unittest.TestCase): uname = 'Windows XP 5.1.2600 x86 x86 Family 15 Model 75 Step ping 2, AuthenticAMD' output = 'lumi\xc3\xa8re' - argv = 'lumi\xc3\xa8re' platform = 'win32' filesystem_encoding = 'mbcs' output_encoding = 'cp65001' - argv_encoding = 'utf-8' + argv_encoding = 'ascii' dirlist = [u'Blah blah.txt', u'test_file', u'\xc4rtonwall.mp3'] class WindowsVista(StringUtils, unittest.TestCase): uname = 'Windows Vista 6.0.6000 x86 x86 Family 6 Model 15 Stepping 11, GenuineIntel' output = 'lumi\x8are' - argv = 'lumi\xc3\xa8re' platform = 'win32' filesystem_encoding = 'mbcs' output_encoding = 'cp850' - argv_encoding = 'utf-8' + argv_encoding = 'ascii' dirlist = [u'Blah blah.txt', u'test_file', u'\xc4rtonwall.mp3'] class MacOSXLeopard(StringUtils, unittest.TestCase): diff --git a/src/allmydata/util/stringutils.py b/src/allmydata/util/stringutils.py index eb511914..d5c20865 100644 --- a/src/allmydata/util/stringutils.py +++ b/src/allmydata/util/stringutils.py @@ -41,8 +41,8 @@ def _reload(): filesystem_encoding = _canonical_encoding(sys.getfilesystemencoding()) output_encoding = _canonical_encoding(sys.stdout.encoding or locale.getpreferredencoding()) if sys.platform == 'win32': - # arguments are converted to utf-8 in windows/tahoe.py - argv_encoding = 'utf-8' + # Unicode arguments are not supported on Windows yet; see #565 and #1074. + argv_encoding = 'ascii' else: argv_encoding = output_encoding is_unicode_platform = sys.platform in ["win32", "darwin"] diff --git a/windows/tahoe.py b/windows/tahoe.py index 42161f48..e3e4b469 100644 --- a/windows/tahoe.py +++ b/windows/tahoe.py @@ -4,16 +4,6 @@ import depends # import dependencies so that py2exe finds them _junk = depends # appease pyflakes import sys -from ctypes import WINFUNCTYPE, POINTER, byref, c_wchar_p, c_int, windll from allmydata.scripts import runner -GetCommandLineW = WINFUNCTYPE(c_wchar_p)(("GetCommandLineW", windll.kernel32)) -CommandLineToArgvW = WINFUNCTYPE(POINTER(c_wchar_p), c_wchar_p, POINTER(c_int)) \ - (("CommandLineToArgvW", windll.shell32)) - -argc = c_int(0) -argv = CommandLineToArgvW(GetCommandLineW(), byref(argc)) -argv_utf8 = [argv[i].encode('utf-8') for i in xrange(1, argc.value)] - -rc = runner(argv_utf8, install_node_control=False) -sys.exit(rc) \ No newline at end of file +sys.exit(runner(install_node_control=False)) \ No newline at end of file