Skip to content

to_clipboard doesn't support unicode #11712

New issue

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

Closed
Winand opened this issue Nov 27, 2015 · 5 comments
Closed

to_clipboard doesn't support unicode #11712

Winand opened this issue Nov 27, 2015 · 5 comments
Labels
IO Data IO issues that don't fit into a more specific label Unicode Unicode strings

Comments

@Winand
Copy link
Contributor

Winand commented Nov 27, 2015

to_clipboard uses ascii encoding. And it cannot be changed.

>>> import pandas as pd
>>> pd.__version__
'0.17.0'
>>> pd.DataFrame(["Hello world"]).to_clipboard()
>>> pd.DataFrame(["Здравствуй, мир"]).to_clipboard()
...
UnicodeEncodeError: 'ascii' codec can't encode characters in position 22-31: ordinal not in range(128)
>>> pd.DataFrame(["Здравствуй, мир"]).to_clipboard(encoding="utf-8")
...
TypeError: to_string() got an unexpected keyword argument 'encoding'

Had to use part of to_clipboard source, where it exports dataframe to StringIO buffer, then put it to clipboard with Qt.

@jreback
Copy link
Contributor

jreback commented Nov 27, 2015

this is fixed by #9693
if you want to give that a try and report

@jreback
Copy link
Contributor

jreback commented Nov 27, 2015

pls report pd.show_versions() for the record as well.

@jreback jreback added IO Data IO issues that don't fit into a more specific label Unicode Unicode strings labels Nov 27, 2015
@Winand
Copy link
Contributor Author

Winand commented Nov 27, 2015

INSTALLED VERSIONS

commit: None
python: 3.4.3.final.0
python-bits: 64
OS: Windows
OS-release: 7
machine: AMD64
processor: Intel64 Family 6 Model 58 Stepping 9, GenuineIntel
byteorder: little
LC_ALL: None
LANG: en

pandas: 0.17.0
nose: 1.3.7
pip: 7.1.2
setuptools: 18.4
Cython: 0.23.4
numpy: 1.9.3
scipy: 0.16.1
statsmodels: None
IPython: 4.0.0
sphinx: 1.3.1
patsy: 0.4.0
dateutil: 2.4.2
pytz: 2015.6
blosc: 1.2.8
bottleneck: 1.0.0
tables: 3.2.2
numexpr: 2.4.4
matplotlib: 1.5.0rc3
openpyxl: None
xlrd: 0.9.4
xlwt: None
xlsxwriter: 0.7.7
lxml: 3.4.4
bs4: 4.4.1
html5lib: None
httplib2: None
apiclient: None
sqlalchemy: 1.0.9
pymysql: None
psycopg2: None

@Winand
Copy link
Contributor Author

Winand commented Nov 30, 2015

Yep, updated clipboard.py works fine here.

@jreback
Copy link
Contributor

jreback commented Nov 30, 2015

dupe of #9263

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
IO Data IO issues that don't fit into a more specific label Unicode Unicode strings
Projects
None yet
Development

No branches or pull requests

2 participants