[issue7768] raw_input should encode unicode prompt with std.stdout.encoding.

2010-01-23 Thread Naoki INADA
New submission from Naoki INADA : raw_input and input should take unicode prompt and encode with sys.stdout.encoding like print or input in py3k. >>> u = u"あいう" >>> print u あいう >>> x = raw_input(u) Traceback (most recent call last): File ""

[issue1754] WindowsError messages are not properly encoded

2010-01-14 Thread Naoki INADA
Naoki INADA added the comment: I think WindowsError's message should be English like other errors. FormatMessageW() function can take dwLanguageId parameter. So I think Python should pass `MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)` to the parameter. -- nosy: +

[issue7072] isspace(0xa0) is true on Mac OS X

2009-10-06 Thread Naoki INADA
New submission from Naoki INADA : Old FreeBSD's libc has a bug relate to utf-8 locale and Python have patch for it: http://svn.python.org/view/python/trunk/Include/pyport.h? view=diff&pathrev=43219&r1=36792&r2=36793 This bug appears in Mac OS X again. This test fails: >>

[issue5911] built-in compile() should take encoding option.

2009-10-03 Thread Naoki INADA
Naoki INADA added the comment: add sample implementation. -- keywords: +patch Added file: http://bugs.python.org/file15030/compile_with_encoding.patch ___ Python tracker <http://bugs.python.org/issue5

[issue6991] logging encoding failes some situation

2009-09-25 Thread Naoki INADA
Naoki INADA added the comment: OK, I agree. Thank you for your answer. -- ___ Python tracker <http://bugs.python.org/issue6991> ___ ___ Python-bugs-list mailin

[issue6991] logging encoding failes some situation

2009-09-25 Thread Naoki INADA
Naoki INADA added the comment: OK, you're right. But logging is very basic feature and used very wide modules. "All logging code should use unicode string" is right but difficult. And logging may be used for debbuging usually. So I think logging should write log as safe as

[issue6991] logging encoding failes some situation

2009-09-25 Thread Naoki INADA
Naoki INADA added the comment: Another sample. Traceback (most recent call last): File "C:\usr\Python2.6\lib\logging\__init__.py", line 790, in emit stream.write(fs % msg.encode("UTF-8")) UnicodeDecodeError: 'ascii' codec can't decode byte 0xaa in p

[issue6991] logging encoding failes some situation

2009-09-25 Thread Naoki INADA
Naoki INADA added the comment: Please see and execute an attached foo.py. In Python 2.6.2, this cause following error: >python foo.py Traceback (most recent call last): File "foo.py", line 3, in f.write('\xaa') File "C:\usr\Python2.6\lib\codecs.py&quo

[issue6991] logging encoding failes some situation

2009-09-25 Thread Naoki INADA
Changes by Naoki INADA : -- type: -> behavior ___ Python tracker <http://bugs.python.org/issue6991> ___ ___ Python-bugs-list mailing list Unsubscri

[issue6991] logging encoding failes some situation

2009-09-24 Thread Naoki INADA
Changes by Naoki INADA : -- versions: +Python 3.0, Python 3.1, Python 3.2 ___ Python tracker <http://bugs.python.org/issue6991> ___ ___ Python-bugs-list mailin

[issue6991] logging encoding failes some situation

2009-09-24 Thread Naoki INADA
New submission from Naoki INADA : When stream is codecs.writer object, stream.write(string) does string.decode() internally and it may cause UnicodeDecodeError. Then, fallback to utf-8 is not good. I think good fallback logic is: * When message is unicode, message.encode(stream.encoding or

[issue6255] PyInt_FromSize_t is undocumented.

2009-06-10 Thread Naoki INADA
Naoki INADA added the comment: You're right. PyInt_FromSize_t() isn't safe for unsigned long. > Maybe a PyInt_FromUnsignedLong method would be useful? It would be trivial to > implement. I hope that all of py3k's PyInt_From** are in Python 2.x. It makes maintaining

[issue6255] PyInt_FromSize_t is undocumented.

2009-06-10 Thread Naoki INADA
New submission from Naoki INADA : PyInt_FromSize_t() is not in Python/C API document. People seeing document may be not able to find how to make int from unsigned long. -- assignee: georg.brandl components: Documentation messages: 89208 nosy: georg.brandl, naoki severity: normal status

[issue5911] built-in compile() should take encoding option.

2009-05-02 Thread Naoki INADA
New submission from Naoki INADA : The built-in compile() expects source is encoded in utf-8. This behavior make it harder to implement alternative shell like IDLE and IPython. (http://bugs.python.org/issue1542677 and https://bugs.launchpad.net/ipython/+bug/339642 are related bugs.) Below is

[issue5768] logging don't encode Unicode message correctly.

2009-04-15 Thread Naoki INADA
Changes by Naoki INADA : Added file: http://bugs.python.org/file13698/logging_init.diff ___ Python tracker <http://bugs.python.org/issue5768> ___ ___ Python-bugs-list m

[issue5768] logging don't encode Unicode message correctly.

2009-04-15 Thread Naoki INADA
Changes by Naoki INADA : Removed file: http://bugs.python.org/file13697/logging_init.diff ___ Python tracker <http://bugs.python.org/issue5768> ___ ___ Python-bugs-list m

[issue5768] logging don't encode Unicode message correctly.

2009-04-15 Thread Naoki INADA
New submission from Naoki INADA : >>> logging.error(u'あ') ERROR:root:縺・ >>> sys.stderr.encoding 'cp932' This bug is introduced by following commit. http://svn.python.org/view/python/branches/release26- maint/Lib/logging/__init__.py?r1=68830&r2=69448

[issue1542677] IDLE shell gives different len() of unicode strings compared to Python shell

2009-04-12 Thread Naoki INADA
Naoki INADA added the comment: How to use locale.getpreferredencoding() instead of locale.nl_langinfo(locale.CODESET). --- IOBinding.py.back Sun Apr 12 19:54:52 2009 +++ IOBinding.pySun Apr 12 20:02:58 2009 @@ -35,40 +35,16 @@ # Encoding for file names filesystemencoding

[issue1542677] IDLE shell gives different len() of unicode strings compared to Python shell

2009-04-12 Thread Naoki INADA
Naoki INADA added the comment: utf-8 is not locale encoding. >>> f = open('á.txt') If this line compiled into utf-8 and locale encoding is not utf-8, can't open 'á.txt'. IMHO, in case of Python 2.x, correct approach is fix IOBindings.enc

[issue1542677] IDLE shell gives different len() of unicode strings compared to Python shell

2009-04-11 Thread Naoki INADA
Naoki INADA added the comment: This patch is for iplib/PyShell.py#ModifiedInterpreter.runsource. if isinstance(source, types.UnicodeType): import IOBinding try: source = source.encode(IOBinding.encoding) +source = "# c

[issue1542677] IDLE shell gives different len() of unicode strings compared to Python shell

2009-04-11 Thread Naoki INADA
Naoki INADA added the comment: This issue is caused by compile() behavior. Following sample is in codepage 932. >>> 'あ' '\x82\xa0' # OK - 'あ' is '\x82\xa0' in cp932 >>> u'あ' u'\u3042' # OK - u'あ&#x