This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author cheryl.sabella
Recipients cheryl.sabella, rhettinger, serhiy.storchaka, terry.reedy
Date 2019-03-07.19:07:12
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1551985632.65.0.795998256578.issue36219@roundup.psfhosted.org>
In-reply-to
Content
Would it be worthwhile to automatically convert the text when it's being pasted or would there be a scenario where it would be desirable to keep these characters in the text?  It seems the point here is that the user wouldn't even realize that the quotes (or dashes) being copied aren't the right ones and they would have to learn to take the extra step of formatting the text.  That seems annoying, so maybe automatic conversion would eliminate that?

For the menu option route, in the editor there is an additional 'Format' menu which has some text manipulation options, but the Shell doesn't have this menu available.  There isn't any formatting options on the 'Edit' menu currently.  Would it be better to add a 'Format' menu to the Shell or have this on the 'Edit' menu (which is already getting long)?

For the actual text conversion, I pasted some smart quotes on Windows and it pasted as \u2018\u2018 (two single left quotations marks) and \u2019\u2019 (two single right quotation marks) instead of \u201C (double left) and \u201D (double right). \u0060 (grave accent) and \u00B4 (acute accent) also seem to be possible values that are used for quotes, although converting them automatically may be more problematic.

I think for starters the idea would be:
text.replace('\u2018\u2018', '"')  
text.replace('\u2019\u2019', '"')  
text.replace('\u2018, "'")
text.replace('\u2019, "'")
text.replace('\u201C, '"')
text.replace('\u201D, '"')

The dash may be more complicated since there are more of them.  Unless the category could be used.
History
Date User Action Args
2019-03-07 19:07:12cheryl.sabellasetrecipients: + cheryl.sabella, rhettinger, terry.reedy, serhiy.storchaka
2019-03-07 19:07:12cheryl.sabellasetmessageid: <1551985632.65.0.795998256578.issue36219@roundup.psfhosted.org>
2019-03-07 19:07:12cheryl.sabellalinkissue36219 messages
2019-03-07 19:07:12cheryl.sabellacreate