Skip to content
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

Fixing #6123 #6125

Merged
merged 2 commits into from
Jul 24, 2017
Merged

Fixing #6123 #6125

merged 2 commits into from
Jul 24, 2017

Conversation

goedzo
Copy link
Contributor

@goedzo goedzo commented Jul 24, 2017

When gym names have unicode names, bot crashes when using GymPokemon task. This fix makes the eventmanager more robust.

@mention-bot
Copy link

@goedzo, thanks for your PR! By analyzing the history of the files in this pull request, we identified @douglascamata, @cmezh and @mjmadsen to be potential reviewers.

@MerlionRock
Copy link
Contributor

MerlionRock commented Jul 24, 2017

👍

Approved with PullApprove

@MerlionRock MerlionRock merged commit 3024cc8 into PokemonGoF:dev Jul 24, 2017
@ChiefM3
Copy link
Contributor

ChiefM3 commented Jul 25, 2017

I'm afraid when arriving at gyms with unicode names, the bot still crashes

I changed this

self.formatted = str(formatted).encode('utf-8', 'ignore').decode('utf-8')
self.formatted = str(formatted).encode('ascii', 'xmlcharrefreplace')

into this

    try:
        self.formatted = str(formatted).encode('utf-8', 'ignore').decode('utf-8')
    except UnicodeEncodeError:
        self.formatted = str(unicode(formatted).encode('unicode_escape'))

After this change, no more crashing. Does this change make sense?
ChiefM3@ea21959

@goedzo
Copy link
Contributor Author

goedzo commented Jul 25, 2017

@ChiefM3 thanks for feedback. I understand issue now. Will fix the fix now :). Solution is almost similair like yours but a little different.

    #Fixing issue 6123 for gym names that are in utf format.
    try:
        self.formatted = str(formatted).encode('ascii', 'xmlcharrefreplace')
    except UnicodeEncodeError:
        self.formatted = str(unicode(formatted).encode('unicode_escape'))

Pull requesting now.

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

Successfully merging this pull request may close these issues.

4 participants