Skip to content

UnicodeEncodeError #68

@trunksn1

Description

@trunksn1

First of all, I like this extension very much!

I'm using it to store fleeting notes of scientific articles I read. However, I've encountered a significant issue when trying to grasp strings containing non-English characters.

For example, if I try to grasp the string "protein α-actinin", I receive the following error:

Traceback (most recent call last):
  File "C:\Users\trunk\AppData\Roaming\Python\Python310\site-packages\grasp_backend\__main__.py", line 125, in do_POST
    self.handle_POST()
  File "C:\Users\trunk\AppData\Roaming\Python\Python310\site-packages\grasp_backend\__main__.py", line 110, in handle_POST
    res = capture(**payload)
  File "C:\Users\trunk\AppData\Roaming\Python\Python310\site-packages\grasp_backend\__main__.py", line 90, in capture
    append_org(
  File "C:\Users\trunk\AppData\Roaming\Python\Python310\site-packages\grasp_backend\__main__.py", line 35, in append_org
    fo.write(org)
  File "C:\Users\trunk\AppData\Local\Programs\Python\Python310\lib\encodings\cp1252.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\u03b1' in position 242: character maps to <undefined>
127.0.0.1 - - [05/Oct/2024 17:18:36] "POST /capture HTTP/1.1" 500 -

It seems that the issue arises from using characters like the Greek letter α. The encoding cp1252 cannot handle these characters, leading to a UnicodeEncodeError.

Is there a way to ensure that the extension supports Unicode characters, such as those used in non-English languages (e.g., Greek, accented letters, etc.)?

This is crucial for my workflow since I often work with scientific terms that include these symbols.

Thank you for your help and for developing this great tool!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions