Re: [Python-Dev] Unicode decode exception

2014-11-30 Thread Chris Angelico
On Sun, Nov 30, 2014 at 7:07 PM, balaji marisetti balajimarise...@gmail.com wrote: Hi, Hi. This list is for the development *of* Python, not development *with* Python, so I'm sending this reply also to python-list@python.org where it can be better handled. You'll probably want to subscribe here:

Re: [Python-Dev] Unicode decode exception

2014-11-30 Thread balaji marisetti
The default encoding is UTF-8. It works if I do: with open(filename, errors=ignore) as f: So I think Python2, by default, ignores all errors whereas Python3 doesn't On 1 December 2014 at 01:49, Chris Angelico ros...@gmail.com wrote: On Sun, Nov 30, 2014 at 7:07 PM, balaji marisetti

Re: [Python-Dev] Unicode decode exception

2014-11-30 Thread Michael Torrie
On 11/30/2014 09:19 PM, balaji marisetti wrote: The default encoding is UTF-8. It works if I do: with open(filename, errors=ignore) as f: So I think Python2, by default, ignores all errors whereas Python3 doesn't Do you mean that the file is supposed to be utf-8 but isn't?

Re: Python and Unicode

2014-04-10 Thread wxjmfauth
Le mercredi 9 avril 2014 10:53:36 UTC+2, Mark Lawrence a écrit : On 09/04/2014 09:07, wxjmfa...@gmail.com wrote: Well, there is a (serious) problem somewhere... jmf Look in a mirror and you'll see it as it'll be staring you in the face. -- My fellow Pythonistas,

Re: Python and Unicode

2014-04-10 Thread Tim Chase
On 2014-04-10 04:47, wxjmfa...@gmail.com wrote: Le mercredi 9 avril 2014 10:53:36 UTC+2, Mark Lawrence a écrit : On 09/04/2014 09:07, wxjmfa...@gmail.com wrote: Well, there is a (serious) problem somewhere... jmf Look in a mirror and you'll see it as it'll be staring you in the

Python and Unicode

2014-04-09 Thread wxjmfauth
Well, there is a (serious) problem somewhere... jmf -- https://mail.python.org/mailman/listinfo/python-list

Re: Python and Unicode

2014-04-09 Thread Mark Lawrence
On 09/04/2014 09:07, wxjmfa...@gmail.com wrote: Well, there is a (serious) problem somewhere... jmf Look in a mirror and you'll see it as it'll be staring you in the face. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark

Re: Python and Unicode

2014-04-09 Thread Steve Hayes
On Wed, 9 Apr 2014 01:07:20 -0700 (PDT), wxjmfa...@gmail.com wrote: Well, there is a (serious) problem somewhere... As there is with pandas and infertility. -- Terms and conditions apply. Steve Hayes hayesm...@hotmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: [Python-ideas] Unicode stdin/stdout

2013-11-18 Thread Nick Coghlan
On 18 Nov 2013 22:36, Robin Becker ro...@reportlab.com wrote: On 18/11/2013 11:47, Robin Becker wrote: ... #c:\python33\lib\site-packages\sitecustomize.py import sys, codecs sys.stdout = codecs.getwriter(utf-8)(sys.stdout.detach()) sys.stderr =

Re: [Python-ideas] Unicode stdin/stdout

2013-11-18 Thread Victor Stinner
Why do you need to force the UTF-8 encoding? Your locale is not correctly configured? It's better to set PYTHONIOENCODING rather than replacing sys.stdout/stderr at runtime. There is an open issue to add a TextIOWrapper.set_encoding() method: http://bugs.python.org/issue15216 Victor --

Re: [Python-ideas] Unicode stdin/stdout

2013-11-18 Thread random832
On Mon, Nov 18, 2013, at 7:33, Robin Becker wrote: UTF-8 stuff This doesn't really solve the issue I was referring to, which is that windows _console_ (i.e. not redirected file or pipe) I/O can only support unicode via wide character (UTF-16) I/O with a special function, not via using byte-based

Re: [Python-ideas] Unicode stdin/stdout

2013-11-18 Thread Andrew Barnert
From: random...@fastmail.us random...@fastmail.us On Mon, Nov 18, 2013, at 7:33, Robin Becker wrote: UTF-8 stuff This doesn't really solve the issue I was referring to, which is that windows _console_ (i.e. not redirected file or pipe) I/O can only support unicode via wide character

Beginner python 3 unicode question

2013-11-16 Thread Laszlo Nagy
Example interactive: $ python3 Python 3.3.1 (default, Sep 25 2013, 19:29:01) [GCC 4.7.3] on linux Type help, copyright, credits or license for more information. import uuid import base64 base64.b32encode(uuid.uuid1().bytes)[:-6].lower() b'zsz653co6ii6hgjejqhw42ncgy' But when I put the same

Re: Beginner python 3 unicode question

2013-11-16 Thread Luuk
On 16-11-2013 20:12, Laszlo Nagy wrote: Example interactive: $ python3 Python 3.3.1 (default, Sep 25 2013, 19:29:01) [GCC 4.7.3] on linux Type help, copyright, credits or license for more information. import uuid import base64 base64.b32encode(uuid.uuid1().bytes)[:-6].lower()

Re: Beginner python 3 unicode question

2013-11-16 Thread Laszlo Nagy
the error is in one of the lines you did not copy here because this works without problems: BEGIN-of script #!/usr/bin/python Most probably, your /usr/bin/python program is python version 2, and not python version 3 Try the same program with /usr/bin/python3. And also try the

Re: Beginner python 3 unicode question

2013-11-16 Thread Laszlo Nagy
Why it is behaving differently on the command line? What should I do to fix this? I was experimenting with this a bit more and found some more confusing things. Can somebody please enlight me? Here is a test function: def password_hash(self,password): public =

Re: Beginner python 3 unicode question

2013-11-16 Thread Luuk
On 16-11-2013 21:57, Laszlo Nagy wrote: the error is in one of the lines you did not copy here because this works without problems: BEGIN-of script #!/usr/bin/python Most probably, your /usr/bin/python program is python version 2, and not python version 3 Try the same program with

Re: Beginner python 3 unicode question [SOLVED]

2013-11-16 Thread Laszlo Nagy
So is the default utf-8 or not? Should the documentation be updated? Or do we have a bug in the interactive shell? It was my fault, sorry. The other program used os.system at some places, and it accidentally used python2 instead of python 3. :-( -- This message has been scanned for

Re: Beginner python 3 unicode question

2013-11-16 Thread Chris Angelico
On Sun, Nov 17, 2013 at 8:19 AM, Laszlo Nagy gand...@shopzeus.com wrote: print(digest,digest,type(digest)) This function was called inside a script, and gave me this: ('digest', '\xa0\x98\x8b\xff\x04\xf9V;\xbd\x1eIHzh\x10-\xc5!\x14\x1b', type 'str') This looks very much like you're

Re: Beginner python 3 unicode question [SOLVED]

2013-11-16 Thread Chris Angelico
On Sun, Nov 17, 2013 at 8:44 AM, Laszlo Nagy gand...@shopzeus.com wrote: So is the default utf-8 or not? Should the documentation be updated? Or do we have a bug in the interactive shell? It was my fault, sorry. The other program used os.system at some places, and it accidentally used

Python wide-python-build unicode for Windows

2011-04-29 Thread satheesh
Hi All, How could i increase the unicode range beyond 1 ? In python 2.5.4 by default the unicode range is 0x1, but in some cases i have unicode char beyond the limit. For those conditions it th an error. File E:\OpenERP\OpenERP AllInOne\Server\library.zip\reportlab\pdfbase\ttfonts.py,

Re: Python wide-python-build unicode for Windows

2011-04-29 Thread Martin v. Loewis
But how could i do this in Windows. It's not supported. Hopefully, it will be supported in Python 3.3, due to PEP 393. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Python wide-python-build unicode for Windows

2011-04-29 Thread Terry Reedy
On 4/29/2011 7:52 AM, sathe...@e-ndicus.com wrote: How could i increase the unicode range beyond 1 ? Use Python3, which, after renaming unichar to chr, changed it to always accept the full range of codepoints, even when that means returning a two-char string on narrow builds, like

Re: Python and unicode

2010-09-20 Thread Goran Novosel
Can't believe I missed something as simple as u'smt', and I even saw that on many occasions... Thank you. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python and unicode

2010-09-20 Thread Dotan Cohen
On Mon, Sep 20, 2010 at 05:42, Steven D'Aprano st...@remove-this-cybersource.com.au wrote: Use the PEP 263 encoding declaration URL:http://www.python.org/dev/peps/pep-0263/ to let Python know the encoding of the program source file. While PEPs are valuable, once accepted or rejected they

Re: Python and unicode

2010-09-20 Thread Peter Otten
Dotan Cohen wrote: On Mon, Sep 20, 2010 at 05:42, Steven D'Aprano st...@remove-this-cybersource.com.au wrote: Use the PEP 263 encoding declaration URL:http://www.python.org/dev/peps/pep-0263/ to let Python know the encoding of the program source file. While PEPs are valuable, once accepted

Re: Python and unicode

2010-09-20 Thread Dotan Cohen
On Mon, Sep 20, 2010 at 12:20, Peter Otten __pete...@web.de wrote: It may work by accident, if you declare it as UTF-8, because that is also the default in Python 3. That does seem to be the case. Thank you for the enlightenment and information. -- Dotan Cohen http://gibberish.co.il

Re: Python and unicode

2010-09-20 Thread Martin v. Loewis
Am 20.09.2010 12:57, schrieb Dotan Cohen: On Mon, Sep 20, 2010 at 12:20, Peter Otten __pete...@web.de wrote: It may work by accident, if you declare it as UTF-8, because that is also the default in Python 3. That does seem to be the case. Thank you for the enlightenment and information.

Python and unicode

2010-09-19 Thread Goran Novosel
Hi everybody. I've played for few hours with encoding in py, but it's still somewhat confusing to me. So I've written a test file (encoded as utf-8). I've put everything I think is true in comment at the beginning of script. Could you check if it's correct (on side note, script does what I

Re: Python and unicode

2010-09-19 Thread Martin v. Loewis
One more thing, is there some mechanism to avoid writing all the time 'something'.decode('utf-8')? Yes, use u'something' instead (i.e. put the letter u before the literal, to make it a unicode literal). Since Python 2.6, you can also put from __future__ import unicode_literals at the top

Re: Python and unicode

2010-09-19 Thread Ben Finney
Goran Novosel goran.novo...@gmail.com writes: # vim: set encoding=utf-8 : This will help Vim, but won't help Python. Use the PEP 263 encoding declaration URL:http://www.python.org/dev/peps/pep-0263/ to let Python know the encoding of the program source file. # -*- coding: utf-8 -*- You

Re: Python and unicode

2010-09-19 Thread Carl Banks
On Sep 19, 4:09 pm, Ben Finney ben+pyt...@benfinney.id.au wrote: Goran Novosel goran.novo...@gmail.com writes: # vim: set encoding=utf-8 : This will help Vim, but won't help Python. Use the PEP 263 encoding declaration URL:http://www.python.org/dev/peps/pep-0263/ to let Python know the

Re: Python and unicode

2010-09-19 Thread Steven D'Aprano
On Mon, 20 Sep 2010 09:09:31 +1000, Ben Finney wrote: Goran Novosel goran.novo...@gmail.com writes: # vim: set encoding=utf-8 : This will help Vim, but won't help Python. It will actually -- the regex Python uses to detect encoding lines is documented, and Vim-style declarations are

Re: python 3.1 unicode question

2009-09-16 Thread Duncan Booth
with the files even if you can't display the filenames. If you are running on Windows and using the native Python to access an NTFS formatted partition then there shouldn't be a problem: the filenames are stored as unicode and Python uses the unicode apis. Of course you may still not be able

Re: python 3.1 unicode question

2009-09-15 Thread Mark Tolonen
jeffunit j...@jeffunit.com wrote in message news:20090915144123964.ljka6...@cdptpa-omta01.mail.rr.com... I wrote a program that diffs files and prints out matching file names. I will be executing the output with sh, to delete select files. Most of the files names are plain ascii, but about 10%

Re: python 3.1 unicode question

2009-09-15 Thread jeffunit
At 09:25 PM 9/15/2009, Mark Tolonen wrote: jeffunit j...@jeffunit.com wrote in message news:20090915144123964.ljka6...@cdptpa-omta01.mail.rr.com... I wrote a program that diffs files and prints out matching file names. I will be executing the output with sh, to delete select files. Most of the

Re: python 3.1 unicode question

2009-09-15 Thread Chris Rebert
On Tue, Sep 15, 2009 at 9:48 PM, jeffunit j...@jeffunit.com wrote: At 09:25 PM 9/15/2009, Mark Tolonen wrote: jeffunit j...@jeffunit.com wrote in message news:20090915144123964.ljka6...@cdptpa-omta01.mail.rr.com... I wrote a program that diffs files and prints out matching file names. I

Python beginner, unicode encode/decode Q

2008-07-14 Thread anonymous
1 Objective to write little programs to help me learn German. See code after numbered comments. //Thanks in advance for any direction or suggestions. tk 2 Want keyboard answer input, for example: answer_str = raw_input(' Enter answer ') Herr Üü [ I keyboard in the following characters

Re: Python beginner, unicode encode/decode Q

2008-07-14 Thread MRAB
On Jul 14, 1:51 pm, anonymous [EMAIL PROTECTED] wrote: 1 Objective to write little programs to help me learn German.  See code after numbered comments. //Thanks in advance for any direction or suggestions. tk 2  Want keyboard answer input, for example:   answer_str  = raw_input(' Enter