Skip to content

[DRAFT] Fix the issue with unicode error#55

Draft
dawidwelna wants to merge 1 commit into
paperboi:masterfrom
dawidwelna:dw_draft
Draft

[DRAFT] Fix the issue with unicode error#55
dawidwelna wants to merge 1 commit into
paperboi:masterfrom
dawidwelna:dw_draft

Conversation

@dawidwelna

Copy link
Copy Markdown

relates to the discussion in this issue #54
I have yet tests to implement. But after quickly changing reading.py I am able to correctly import clippings which do have polish characters such as "ę", "ł", "ą"
FYI @paperboi

Comment thread environment.yml
@@ -0,0 +1,17 @@
name: kindle2Notion

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this file for? Seems like some conda stuff. If @paperboi is ok with that, please add some documentation about that, preferably to readme file.

Comment thread environment.yml
- flake8>=3.9.2
- pytest>=6.2.4
- pytest-cov>=2.12.0
- black>=21.5b2

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So dependencies are now in both places - here and in requirements.txt file?

Comment thread .gitignore

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just .idea/? It should do the job. Why do you need to specify these all items additionally?

Comment thread kindle2notion/reading.py
raw_clippings_text = open(clippings_file_path, "r", encoding="utf-8-sig").read()
raw_clippings_text = raw_clippings_text.encode("ascii").decode()
except UnicodeEncodeError:
print('UnicodeEncodeError, encoding data with utf-8')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you could print the exact error here?

Comment thread kindle2notion/reading.py
except UnicodeEncodeError:
print('UnicodeEncodeError, encoding data with utf-8')
raw_clippings_text = open(clippings_file_path, "r", encoding="utf-8").read()
raw_clippings_text = raw_clippings_text.encode("UTF8").decode()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should provide test for such case.

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.

2 participants