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

Fix scene name unicode save error #566

Closed
wants to merge 5 commits into from

Conversation

p0psicles
Copy link
Contributor

How to reproduce the issue:

  1. Run medusa on windows. I've used Windows 7
  2. Make sure used locale is x.cp1252
  3. Add Naruto Shippuuden
  4. Now you can open the show in displayShow and editShow just fine.
  5. Go to editShow and save the show, you should be redirected to displayShow
  6. You'r getting a mako 500 error page.

image

  • PR is based on the DEVELOP branch
  • Don't send big changes all at once. Split up big PRs into multiple smaller PRs that are easier to manage and review
  • Always make sure the PR has a clear description of why,how, and what your trying to fix. The same goes for improvements or new features. Also if you refering to an issue, make sure a summary is available in the PR.
  • Read contribution guide

@@ -273,9 +273,9 @@ def update_scene_exceptions(indexer_id, scene_exceptions, season=-1):
# A change has been made to the scene exception list. Let's clear the cache, to make this visible
if indexer_id in exceptionsCache:
exceptionsCache[indexer_id] = {}
exceptionsCache[indexer_id][season] = scene_exceptions
exceptionsCache[indexer_id][season] = [se.decode('utf-8', 'ignore') for se in scene_exceptions]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@labrys @medariox your both the unicode guru's here. Is this the way to solve this? It seems to work for me now? Still have to test on other linux with utf8.

Copy link
Contributor

Choose a reason for hiding this comment

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

The question is: why is scene_exceptions a list of encoded items and not decoded items (like it should be)? It would be best to decode scene_exceptions at the "source". About decode('utf-8', 'ignore') I would personally prefer decode('utf-8', 'replace'), but - until we finish the transition to unicode everywhere - there is nothing wrong about it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It should be unicode encoded right? Else you can't display the chinese chars right?
I personally think it's an issue with tornado, it is processing the post by default as encoded in str(). While it should be encoded in unicode.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, I would say the problem is that when you add an exception that contains chars that your locale doesn't support (in your case cp1252) the join() that takes place in displayShow tries to decode them with the default locale, but fails.

@p0psicles
Copy link
Contributor Author

I've PR'd his one towards fix-bwl. When that's merged, i'm going to create a new one for dev. In the mean time, we can discuss here.

@fernandog
Copy link
Contributor

#557

labrys and others added 5 commits May 11, 2016 09:24
Clean-up blackwhitelist.py
Fix label in deluge, needs to be lower case
…hippuuden. The error only occurs on Windows. I'm explicitly saving scene_exceptions as unicode to the exception list and db.
@p0psicles p0psicles force-pushed the fix-scene-name-unicode-save-error branch from 14d08d2 to 3133d5f Compare May 11, 2016 17:19
@p0psicles p0psicles closed this May 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants