Skip to content
This repository was archived by the owner on May 12, 2024. It is now read-only.

Getting UnicodeEncodeError #2

Closed
JacoboGuijar opened this issue Sep 21, 2020 · 1 comment
Closed

Getting UnicodeEncodeError #2

JacoboGuijar opened this issue Sep 21, 2020 · 1 comment

Comments

@JacoboGuijar
Copy link

JacoboGuijar commented Sep 21, 2020

Trying to execute this query:

query = {
    'fields': [
        {'items': ['Comunicado Oficial:'], 'from' : 'realmadrid'}
    ],
    
}
tweets = BlueBird().search(query)
for tweet in tweets:
    print(tweet["full_text"])

I am getting this:

Traceback (most recent call last):
  File "c:\Users\jacob\OneDrive\Escritorio\Futbol & Python friends4ever\vikingos.py", line 16, in <module>
    print(tweet["full_text"])
  File "C:\Users\jacob\AppData\Local\Programs\Python\Python38\lib\encodings\cp1252.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode characters in position 41-42: character maps to <undefined>

Any idea on how to solve it?

@brunneis
Copy link
Member

Hi @JacoboGuijar,

Maybe it's related with the shell you are using and unsupported characters (e.g., emojis). What happens if you dump the content to a file instead? I don't have Windows installed to try it there. I've just ran it successfully on MacOS.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants