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

string.encode bug #30

Open
ghost opened this issue Sep 12, 2016 · 2 comments
Open

string.encode bug #30

ghost opened this issue Sep 12, 2016 · 2 comments

Comments

@ghost
Copy link

ghost commented Sep 12, 2016

Archive: agi.py
Bug Python 3 at Line: 128
return ''.join(['"', string.encode('utf8', 'ignore'), '"'])

Correction:
return ''.join(['"', string.encode('ascii', 'ignore').decode('ascii'), '"'])

@ghost
Copy link

ghost commented Nov 2, 2016

I had trouble with this, too. In fact, I just ended up with

def _quote(self, string):
    joined = '"' + string + '"'
    return joined`

And it appears to work OK.

This is also being discussed at #19 - would you mind adding to that too? The more the better!

@ghost ghost mentioned this issue Nov 2, 2016
@mjmunger
Copy link

mjmunger commented Jun 1, 2018

I have been battling this for nearly (wasted) three hours now.

Neither the correction above works in 3.6.1, nor does the existing code (master).

Just returning the string before the join statement fixes the issue.

I realize there are some other considerations, but we really need to make a decision on the best implementation from the PRs becuase others will waste hours on it as well.

@ghost ghost mentioned this issue Jun 23, 2019
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

No branches or pull requests

1 participant