Re: Making IDLE3 ignore non-BMP characters instead of throwing an exception?

2016-10-21 Thread Adam Funk
On 2016-10-17, eryk sun wrote: > On Mon, Oct 17, 2016 at 2:20 PM, Adam Funk wrote: >> I'm using IDLE 3 (with python 3.5.2) to work interactively with >> Twitter data, which of course contains emojis. Whenever the running >> program tries to print the text of a tweet with an emoji, it barfs >> th

Re: Making IDLE3 ignore non-BMP characters instead of throwing an exception?

2016-10-17 Thread eryk sun
On Tue, Oct 18, 2016 at 2:09 AM, Chris Angelico wrote: > That's not a UTF-16 encoded byte string, though. It's a Unicode string > that contains two surrogates. So maybe the solution is to convert from > true Unicode strings into strings like the above - but if so, it > absolutely must not be done

Re: Making IDLE3 ignore non-BMP characters instead of throwing an exception?

2016-10-17 Thread Chris Angelico
On Tue, Oct 18, 2016 at 10:23 AM, eryk sun wrote: > I don't know whether it causes problems elsewhere in Tk, but it has no > problem passing along a UTF-16 string to Windows. For example, see the > following with a breakpoint set on TextOut [1]: > > >>> root = tkinter.Tk() > >>> w = tkinte

Re: Making IDLE3 ignore non-BMP characters instead of throwing an exception?

2016-10-17 Thread eryk sun
On Mon, Oct 17, 2016 at 8:35 PM, Random832 wrote: > On Mon, Oct 17, 2016, at 14:20, eryk sun wrote: >> You can patch print() to transcode non-BMP characters as surrogate >> pairs. For example: >> >> On Windows this should allow printing non-BMP characters such as >> emojis (e.g. U+0001F44C). > > I

Re: Making IDLE3 ignore non-BMP characters instead of throwing an exception?

2016-10-17 Thread Random832
On Mon, Oct 17, 2016, at 14:20, eryk sun wrote: > You can patch print() to transcode non-BMP characters as surrogate > pairs. For example: > > On Windows this should allow printing non-BMP characters such as > emojis (e.g. U+0001F44C). I thought there was some reason this wouldn't work with tk, o

Re: Making IDLE3 ignore non-BMP characters instead of throwing an exception?

2016-10-17 Thread eryk sun
On Mon, Oct 17, 2016 at 2:20 PM, Adam Funk wrote: > I'm using IDLE 3 (with python 3.5.2) to work interactively with > Twitter data, which of course contains emojis. Whenever the running > program tries to print the text of a tweet with an emoji, it barfs > this & stops running: > > UnicodeEncod

Re: Making IDLE3 ignore non-BMP characters instead of throwing an exception?

2016-10-17 Thread Adam Funk
On 2016-10-17, Adam Funk wrote: > I'm using IDLE 3 (with python 3.5.2) to work interactively with > Twitter data, which of course contains emojis. Whenever the running > program tries to print the text of a tweet with an emoji, it barfs > this & stops running: > > UnicodeEncodeError: 'UCS-2' co

Making IDLE3 ignore non-BMP characters instead of throwing an exception?

2016-10-17 Thread Adam Funk
I'm using IDLE 3 (with python 3.5.2) to work interactively with Twitter data, which of course contains emojis. Whenever the running program tries to print the text of a tweet with an emoji, it barfs this & stops running: UnicodeEncodeError: 'UCS-2' codec can't encode characters in position 10