Re: Unicode failure

2015-12-07 Thread Oscar Benjamin
On Sun, 6 Dec 2015 at 23:11 Quivis wrote: > On Fri, 04 Dec 2015 13:07:38 -0500, D'Arcy J.M. Cain wrote: > > > I thought that going to Python 3.4 would solve my Unicode issues but it > > seems I still don't understand this stuff. Here is my script. > > > > #!

Re: Unicode failure (Solved)

2015-12-06 Thread Dave Farrance
"D'Arcy J.M. Cain" wrote: >On Fri, 4 Dec 2015 18:28:22 -0500 >Terry Reedy wrote: >> Tk widgets, and hence IDLE windows, will print any character from >> \u to \u without raising, even if the result is blank or ?. >> Higher codepoints fail, but

Re: Unicode failure

2015-12-06 Thread Dave Farrance
I was taking it for granted that you knew how to set environment variables, but just in case you don't: In the shell, (are you using BASH?), put this: export PYTHONIOENCODING=UTF-8 ...then run your script. Remember that this is *not* a permanent fix. --

Re: Unicode failure

2015-12-06 Thread Dave Farrance
"D'Arcy J.M. Cain" wrote: >... >utf-8 >Traceback (most recent call last): > File "./g", line 5, in >print(u"\N{TRADE MARK SIGN}") >UnicodeEncodeError: 'ascii' codec can't encode character '\u2122' in >position 0: ordinal not in range(128) I *presume* that you're

Re: Unicode failure

2015-12-06 Thread Mark Lawrence
On 06/12/2015 09:06, Dave Farrance wrote: "D'Arcy J.M. Cain" wrote: ... utf-8 Traceback (most recent call last): File "./g", line 5, in print(u"\N{TRADE MARK SIGN}") UnicodeEncodeError: 'ascii' codec can't encode character '\u2122' in position 0: ordinal not in

Re: Unicode failure

2015-12-06 Thread Random832
Mark Lawrence writes: > On 06/12/2015 09:06, Dave Farrance wrote: >> "D'Arcy J.M. Cain" wrote: >>> utf-8 >>> Traceback (most recent call last): >>> File "./g", line 5, in >>> print(u"\N{TRADE MARK SIGN}") >>> UnicodeEncodeError: 'ascii'

Re: Unicode failure

2015-12-05 Thread eryk sun
On Sat, Dec 5, 2015 at 12:10 AM, Chris Angelico wrote: > On Sat, Dec 5, 2015 at 5:06 PM, Terry Reedy wrote: >> On 12/4/2015 10:22 PM, Random832 wrote: >>> >>> On 2015-12-04, Terry Reedy wrote: Tk widgets, and hence IDLE windows,

Re: Unicode failure (Solved)

2015-12-05 Thread D'Arcy J.M. Cain
On Fri, 4 Dec 2015 18:28:22 -0500 Terry Reedy wrote: > Tk widgets, and hence IDLE windows, will print any character from > \u to \u without raising, even if the result is blank or �. > Higher codepoints fail, but allowing the entire BMP is better than > any Windows

Re: Unicode failure

2015-12-05 Thread Random832
On 2015-12-05, Terry Reedy wrote: > On 12/4/2015 10:22 PM, Random832 wrote: >> Well, any bar 1200, 1201, 12000, 12001, 65000, 65001, and 54936. > > Test before you post. As someone else pointed out, I meant that as a list of codepages which support all Unicode codepoints, not a

Re: Unicode failure

2015-12-05 Thread Oscar Benjamin
On 5 Dec 2015 06:10, "D'Arcy J.M. Cain" wrote: > > On Fri, 4 Dec 2015 18:28:22 -0500 > Terry Reedy wrote: > > On 12/4/2015 1:07 PM, D'Arcy J.M. Cain wrote: > > > I thought that going to Python 3.4 would solve my Unicode issues > > > > Within Python

Re: Unicode failure

2015-12-05 Thread Terry Reedy
On 12/5/2015 2:44 PM, Random832 wrote: On 2015-12-05, Terry Reedy wrote: On 12/4/2015 10:22 PM, Random832 wrote: Well, any bar 1200, 1201, 12000, 12001, 65000, 65001, and 54936. Test before you post. As someone else pointed out, I meant that as a list of codepages which

Re: Unicode failure

2015-12-05 Thread eryk sun
On Sat, Dec 5, 2015 at 4:03 PM, Terry Reedy wrote: > On 12/5/2015 2:44 PM, Random832 wrote: >> As someone else pointed out, I meant that as a list of codepages >> which support all Unicode codepoints, not a list of codepoints >> not supported by Tk's UCS-2. Sorry, I assumed

Re: Unicode failure

2015-12-04 Thread Oscar Benjamin
On 4 Dec 2015 22:34, "D'Arcy J.M. Cain" wrote: > > I thought that going to Python 3.4 would solve my Unicode issues but it > seems I still don't understand this stuff. Here is my script. > > #! /usr/bin/python3 > # -*- coding: UTF-8 -*- > import sys >

RE: Unicode failure

2015-12-04 Thread Albert-Jan Roskam
I think you need to use a raw unicode string, ur >>> unicodedata.name(ur'\u2122') 'TRADE MARK SIGN' > Date: Fri, 4 Dec 2015 13:07:38 -0500 > From: da...@vybenetworks.com > To: python-list@python.org > Subject: Unicode failure > > I thought that going to Python 3.4 wo

Unicode failure

2015-12-04 Thread D'Arcy J.M. Cain
I thought that going to Python 3.4 would solve my Unicode issues but it seems I still don't understand this stuff. Here is my script. #! /usr/bin/python3 # -*- coding: UTF-8 -*- import sys print(sys.getdefaultencoding()) print(u"\N{TRADE MARK SIGN}") And here is my output. utf-8 Traceback

Re: Unicode failure

2015-12-04 Thread Peter Otten
D'Arcy J.M. Cain wrote: > I thought that going to Python 3.4 would solve my Unicode issues but it > seems I still don't understand this stuff. Here is my script. > > #! /usr/bin/python3 > # -*- coding: UTF-8 -*- > import sys > print(sys.getdefaultencoding()) > print(u"\N{TRADE MARK SIGN}") > >

Re: Unicode failure

2015-12-04 Thread Terry Reedy
On 12/4/2015 1:07 PM, D'Arcy J.M. Cain wrote: I thought that going to Python 3.4 would solve my Unicode issues Within Python itself, that should be mostly true. As soon as you send text to a display, the rules of the display device take over. #! /usr/bin/python3 # -*- coding: UTF-8 -*-

Re: Unicode failure

2015-12-04 Thread Random832
On 2015-12-04, Terry Reedy wrote: > Tk widgets, and hence IDLE windows, will print any character from \u > to \u without raising, even if the result is blank or �. Higher > codepoints fail, but allowing the entire BMP is better than any Windows > codepage. Well, any

Re: Unicode failure

2015-12-04 Thread D'Arcy J.M. Cain
On Fri, 4 Dec 2015 22:49:49 + Albert-Jan Roskam wrote: > I think you need to use a raw unicode string, ur > > >>> unicodedata.name(ur'\u2122') > 'TRADE MARK SIGN' That seems to work in 2.x but not 3.x. -- D'Arcy J.M. Cain Vybe Networks Inc.

Re: Unicode failure

2015-12-04 Thread Terry Reedy
On 12/4/2015 10:22 PM, Random832 wrote: On 2015-12-04, Terry Reedy wrote: Tk widgets, and hence IDLE windows, will print any character from \u to \u without raising, even if the result is blank or �. Higher codepoints fail, but allowing the entire BMP is better than

Re: Unicode failure

2015-12-04 Thread D'Arcy J.M. Cain
On Fri, 4 Dec 2015 18:28:22 -0500 Terry Reedy wrote: > On 12/4/2015 1:07 PM, D'Arcy J.M. Cain wrote: > > I thought that going to Python 3.4 would solve my Unicode issues > > Within Python itself, that should be mostly true. As soon as you > send text to a display, the rules of

Re: Unicode failure

2015-12-04 Thread Chris Angelico
On Sat, Dec 5, 2015 at 5:06 PM, Terry Reedy wrote: > On 12/4/2015 10:22 PM, Random832 wrote: >> >> On 2015-12-04, Terry Reedy wrote: >>> >>> Tk widgets, and hence IDLE windows, will print any character from \u >>> to \u without raising, even if the

Re: Unicode failure

2015-12-04 Thread Terry Reedy
On 12/4/2015 11:15 PM, D'Arcy J.M. Cain wrote: On Fri, 4 Dec 2015 22:49:49 + Albert-Jan Roskam wrote: I think you need to use a raw unicode string, ur Nope. The 'r' prefix does not disable unicode escapes. unicodedata.name(ur'\u2122') 'TRADE MARK SIGN' If