Skip to content

UnicodeEncodeError: 'ascii' codec can't encode character '\xe1' in position 28: ordinal not in range(128) #23

@incodemode

Description

@incodemode

Hi

When you try to block an user with special character 'á' it throws UnicodeEncodeError on line 102 of api.py.
I already tried with the following transformations and none were able to actually block the user via api call:

urlsafe_username = urllib.parse.quote(username)
urlsafe_username = urllib.parse.quote_plus(username)
urlsafe_username = urllib.parse.quote_plus(username.encode())
urlsafe_username = username.encode()

this is an example

username = "KarmapaolaHernándezlopez"
response = json.loads(conn.call("POST", f"/api/feedback/{username}/", {'feedback': 'block_without_feedback'}))

is there a special way to add the username parameter without having to worry about that special character 'á'?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions