We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
This is an aide-memoire for some of the utf-8 related code for python2...
If we add £3.99 to the clipboard, then (with debugging turned on) we see the in-memory buffer holds:
£3.99
python3: '£3.99' (we can walk away at this point...)
'£3.99'
python2: '\xc2\xa33.99'
'\xc2\xa33.99'
In both cases, the JSON history file will contain the 'ascii-fied' "\u00a33.99"
"\u00a33.99"
However, with python2 when the history file is read back in, it becomes:
python2 u'\xa33.99'
u'\xa33.99'
This causes the smart-update and duplicates code to fail, since these will be treated as unequal when compared.
The solution is to always try to decode('utf-8') the selection, ignoring any failures. This will ensure that all comparisons are of u'' objects.
decode('utf-8')
u''
The other solution of course is to just use python3.
The text was updated successfully, but these errors were encountered:
Better unicode handling for python 2. Fixes #1
87ec593
No branches or pull requests
This is an aide-memoire for some of the utf-8 related code for python2...
If we add
£3.99
to the clipboard, then (with debugging turned on) we see the in-memory buffer holds:python3:
'£3.99'
(we can walk away at this point...)python2:
'\xc2\xa33.99'
In both cases, the JSON history file will contain the 'ascii-fied'
"\u00a33.99"
However, with python2 when the history file is read back in, it becomes:
python2
u'\xa33.99'
This causes the smart-update and duplicates code to fail, since these will be treated as unequal when compared.
The solution is to always try to
decode('utf-8')
the selection, ignoring any failures. This will ensure that all comparisons are ofu''
objects.The other solution of course is to just use python3.
The text was updated successfully, but these errors were encountered: