Repository: pymedusa/Medusa

Issue:
[APP SUBMITTED]: UnicodeDecodeError: 'utf8' codec can't decode byte 0x92 in position 26: invalid start byte

### INFO
**Python Version**: `2.7.14 (default, May 28 2018, 14:47:18) [GCC 4.7.3 20130102 (prerelease)]`
**Operating System**: `Linux-3.10.105-x86_64-with-glibc2.2.5`
**Locale**: `None`
**Branch**: [master](../tree/master)
**Database**: `44.12`
**Commit**: pymedusa/Medusa@4614efc77151ded92ef458a09dec39f8bd5acfc6
**Link to Log**: https://gist.github.com/947b7d49694fec89492cbf1bfa870df8
### ERROR
<pre>
2018-10-20 09:12:08 ERROR    SHOWQUEUE-ADD :: [4614efc] Error searching dir for episodes: 'utf8' codec can't decode byte 0x92 in position 26: invalid start byte
Traceback (most recent call last):
  File "/volume1/@appstore/sickbeard-custom/var/SickBeard/<a href="../blob/4614efc77151ded92ef458a09dec39f8bd5acfc6/medusa/show_queue.py#L617">medusa/show_queue.py</a>", line 617, in run
    self.show.load_episodes_from_dir()
  File "/volume1/@appstore/sickbeard-custom/var/SickBeard/<a href="../blob/4614efc77151ded92ef458a09dec39f8bd5acfc6/medusa/tv/series.py#L985">medusa/tv/series.py</a>", line 985, in load_episodes_from_dir
    media_files = helpers.list_media_files(self.location)
  File "/volume1/@appstore/sickbeard-custom/var/SickBeard/<a href="../blob/4614efc77151ded92ef458a09dec39f8bd5acfc6/medusa/helpers/__init__.py#L262">medusa/helpers/__init__.py</a>", line 262, in list_media_files
    files += list_media_files(full_cur_file)
  File "/volume1/@appstore/sickbeard-custom/var/SickBeard/<a href="../blob/4614efc77151ded92ef458a09dec39f8bd5acfc6/medusa/helpers/__init__.py#L257">medusa/helpers/__init__.py</a>", line 257, in list_media_files
    for cur_file in os.listdir(path):
  File "/volume1/@appstore/sickbeard-custom/var/SickBeard/<a href="../blob/4614efc77151ded92ef458a09dec39f8bd5acfc6/medusa/init/filesystem.py#L113">medusa/init/filesystem.py</a>", line 113, in patched_output
    return handle_output(f(*args, **kwargs))
  File "/volume1/@appstore/sickbeard-custom/var/SickBeard/<a href="../blob/4614efc77151ded92ef458a09dec39f8bd5acfc6/medusa/init/filesystem.py#L50">medusa/init/filesystem.py</a>", line 50, in _handle_output_u
    return list(map(_handle_output_u, result))
  File "/volume1/@appstore/sickbeard-custom/var/SickBeard/<a href="../blob/4614efc77151ded92ef458a09dec39f8bd5acfc6/medusa/init/filesystem.py#L47">medusa/init/filesystem.py</a>", line 47, in _handle_output_u
    return decode(result)
  File "/volume1/@appstore/sickbeard-custom/var/SickBeard/<a href="../blob/4614efc77151ded92ef458a09dec39f8bd5acfc6/medusa/init/filesystem.py#L32">medusa/init/filesystem.py</a>", line 32, in decode
    return text_type(value, 'utf-8' if os.name != 'nt' else fs_encoding)
UnicodeDecodeError: 'utf8' codec can't decode byte 0x92 in position 26: invalid start byte
</pre>
---
_STAFF NOTIFIED_: @pymedusa/support @pymedusa/moderators



Discussion:

### INFO
**Python Version**: `2.7.14 (default, May 28 2018, 14:47:18) [GCC 4.7.3 20130102 (prerelease)]`
**Operating System**: `Linux-3.10.105-x86_64-with-glibc2.2.5`
**Locale**: `None`
**Branch**: [master](../tree/master)
**Database**: `44.12`
**Commit**: pymedusa/Medusa@4614efc77151ded92ef458a09dec39f8bd5acfc6
**Link to Log**: https://gist.github.com/a9ae77ca5109ebfe5842c4e8395383d2
### ERROR
<pre>
2018-10-20 09:49:37 ERROR    SHOWQUEUE-ADD :: [4614efc] Error searching dir for episodes: 'utf8' codec can't decode byte 0x92 in position 23: invalid start byte
Traceback (most recent call last):
  File "/volume1/@appstore/sickbeard-custom/var/SickBeard/<a href="../blob/4614efc77151ded92ef458a09dec39f8bd5acfc6/medusa/show_queue.py#L617">medusa/show_queue.py</a>", line 617, in run
    self.show.load_episodes_from_dir()
  File "/volume1/@appstore/sickbeard-custom/var/SickBeard/<a href="../blob/4614efc77151ded92ef458a09dec39f8bd5acfc6/medusa/tv/series.py#L985">medusa/tv/series.py</a>", line 985, in load_episodes_from_dir
    media_files = helpers.list_media_files(self.location)
  File "/volume1/@appstore/sickbeard-custom/var/SickBeard/<a href="../blob/4614efc77151ded92ef458a09dec39f8bd5acfc6/medusa/helpers/__init__.py#L262">medusa/helpers/__init__.py</a>", line 262, in list_media_files
    files += list_media_files(full_cur_file)
  File "/volume1/@appstore/sickbeard-custom/var/SickBeard/<a href="../blob/4614efc77151ded92ef458a09dec39f8bd5acfc6/medusa/helpers/__init__.py#L257">medusa/helpers/__init__.py</a>", line 257, in list_media_files
    for cur_file in os.listdir(path):
  File "/volume1/@appstore/sickbeard-custom/var/SickBeard/<a href="../blob/4614efc77151ded92ef458a09dec39f8bd5acfc6/medusa/init/filesystem.py#L113">medusa/init/filesystem.py</a>", line 113, in patched_output
    return handle_output(f(*args, **kwargs))
  File "/volume1/@appstore/sickbeard-custom/var/SickBeard/<a href="../blob/4614efc77151ded92ef458a09dec39f8bd5acfc6/medusa/init/filesystem.py#L50">medusa/init/filesystem.py</a>", line 50, in _handle_output_u
    return list(map(_handle_output_u, result))
  File "/volume1/@appstore/sickbeard-custom/var/SickBeard/<a href="../blob/4614efc77151ded92ef458a09dec39f8bd5acfc6/medusa/init/filesystem.py#L47">medusa/init/filesystem.py</a>", line 47, in _handle_output_u
    return decode(result)
  File "/volume1/@appstore/sickbeard-custom/var/SickBeard/<a href="../blob/4614efc77151ded92ef458a09dec39f8bd5acfc6/medusa/init/filesystem.py#L32">medusa/init/filesystem.py</a>", line 32, in decode
    return text_type(value, 'utf-8' if os.name != 'nt' else fs_encoding)
UnicodeDecodeError: 'utf8' codec can't decode byte 0x92 in position 23: invalid start byte
</pre>
---
_STAFF NOTIFIED_: @pymedusa/support @pymedusa/moderators


### INFO
**Python Version**: `2.7.14 (default, May 28 2018, 14:47:18) [GCC 4.7.3 20130102 (prerelease)]`
**Operating System**: `Linux-3.10.105-x86_64-with-glibc2.2.5`
**Locale**: `None`
**Branch**: [master](../tree/master)
**Database**: `44.12`
**Commit**: pymedusa/Medusa@4614efc77151ded92ef458a09dec39f8bd5acfc6
**Link to Log**: https://gist.github.com/152b6ae3c5cb6b12c518d5842401adb2
### ERROR
<pre>
2018-10-20 09:44:26 ERROR    SHOWQUEUE-ADD :: [4614efc] Error searching dir for episodes: 'utf8' codec can't decode byte 0xe6 in position 20: invalid continuation byte
Traceback (most recent call last):
  File "/volume1/@appstore/sickbeard-custom/var/SickBeard/<a href="../blob/4614efc77151ded92ef458a09dec39f8bd5acfc6/medusa/show_queue.py#L617">medusa/show_queue.py</a>", line 617, in run
    self.show.load_episodes_from_dir()
  File "/volume1/@appstore/sickbeard-custom/var/SickBeard/<a href="../blob/4614efc77151ded92ef458a09dec39f8bd5acfc6/medusa/tv/series.py#L985">medusa/tv/series.py</a>", line 985, in load_episodes_from_dir
    media_files = helpers.list_media_files(self.location)
  File "/volume1/@appstore/sickbeard-custom/var/SickBeard/<a href="../blob/4614efc77151ded92ef458a09dec39f8bd5acfc6/medusa/helpers/__init__.py#L262">medusa/helpers/__init__.py</a>", line 262, in list_media_files
    files += list_media_files(full_cur_file)
  File "/volume1/@appstore/sickbeard-custom/var/SickBeard/<a href="../blob/4614efc77151ded92ef458a09dec39f8bd5acfc6/medusa/helpers/__init__.py#L257">medusa/helpers/__init__.py</a>", line 257, in list_media_files
    for cur_file in os.listdir(path):
  File "/volume1/@appstore/sickbeard-custom/var/SickBeard/<a href="../blob/4614efc77151ded92ef458a09dec39f8bd5acfc6/medusa/init/filesystem.py#L113">medusa/init/filesystem.py</a>", line 113, in patched_output
    return handle_output(f(*args, **kwargs))
  File "/volume1/@appstore/sickbeard-custom/var/SickBeard/<a href="../blob/4614efc77151ded92ef458a09dec39f8bd5acfc6/medusa/init/filesystem.py#L50">medusa/init/filesystem.py</a>", line 50, in _handle_output_u
    return list(map(_handle_output_u, result))
  File "/volume1/@appstore/sickbeard-custom/var/SickBeard/<a href="../blob/4614efc77151ded92ef458a09dec39f8bd5acfc6/medusa/init/filesystem.py#L47">medusa/init/filesystem.py</a>", line 47, in _handle_output_u
    return decode(result)
  File "/volume1/@appstore/sickbeard-custom/var/SickBeard/<a href="../blob/4614efc77151ded92ef458a09dec39f8bd5acfc6/medusa/init/filesystem.py#L32">medusa/init/filesystem.py</a>", line 32, in decode
    return text_type(value, 'utf-8' if os.name != 'nt' else fs_encoding)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xe6 in position 20: invalid continuation byte
</pre>
---
_STAFF NOTIFIED_: @pymedusa/support @pymedusa/moderators


### INFO
**Python Version**: `2.7.14 (default, May 28 2018, 14:47:18) [GCC 4.7.3 20130102 (prerelease)]`
**Operating System**: `Linux-3.10.105-x86_64-with-glibc2.2.5`
**Locale**: `None`
**Branch**: [master](../tree/master)
**Database**: `44.12`
**Commit**: pymedusa/Medusa@4614efc77151ded92ef458a09dec39f8bd5acfc6
**Link to Log**: https://gist.github.com/3158e0455ac1c3e5accd5bfef7b8cda3
### ERROR
<pre>
2018-10-21 09:07:25 ERROR    Thread_3 :: [4614efc] Exception generated: 'utf8' codec can't decode byte 0x92 in position 23: invalid start byte
Traceback (most recent call last):
  File "/volume1/@appstore/sickbeard-custom/var/SickBeard/<a href="../blob/4614efc77151ded92ef458a09dec39f8bd5acfc6/medusa/server/web/core/base.py#L259">medusa/server/web/core/base.py</a>", line 259, in async_call
    result = function(**kwargs)
  File "/volume1/@appstore/sickbeard-custom/var/SickBeard/<a href="../blob/4614efc77151ded92ef458a09dec39f8bd5acfc6/medusa/server/web/home/post_process.py#L49">medusa/server/web/home/post_process.py</a>", line 49, in processEpisode
    ignore_subs=argToBool(ignore_subs)
  File "/volume1/@appstore/sickbeard-custom/var/SickBeard/<a href="../blob/4614efc77151ded92ef458a09dec39f8bd5acfc6/medusa/process_tv.py#L126">medusa/process_tv.py</a>", line 126, in process
    if not self.should_process(path, failed):
  File "/volume1/@appstore/sickbeard-custom/var/SickBeard/<a href="../blob/4614efc77151ded92ef458a09dec39f8bd5acfc6/medusa/process_tv.py#L213">medusa/process_tv.py</a>", line 213, in should_process
    for root, dirs, files in os.walk(path):
  File "/volume1/@appstore/sickbeard-custom/env/lib/python2.7/os.py", line 278, in walk
    names = listdir(top)
  File "/volume1/@appstore/sickbeard-custom/var/SickBeard/<a href="../blob/4614efc77151ded92ef458a09dec39f8bd5acfc6/medusa/init/filesystem.py#L113">medusa/init/filesystem.py</a>", line 113, in patched_output
    return handle_output(f(*args, **kwargs))
  File "/volume1/@appstore/sickbeard-custom/var/SickBeard/<a href="../blob/4614efc77151ded92ef458a09dec39f8bd5acfc6/medusa/init/filesystem.py#L50">medusa/init/filesystem.py</a>", line 50, in _handle_output_u
    return list(map(_handle_output_u, result))
  File "/volume1/@appstore/sickbeard-custom/var/SickBeard/<a href="../blob/4614efc77151ded92ef458a09dec39f8bd5acfc6/medusa/init/filesystem.py#L47">medusa/init/filesystem.py</a>", line 47, in _handle_output_u
    return decode(result)
  File "/volume1/@appstore/sickbeard-custom/var/SickBeard/<a href="../blob/4614efc77151ded92ef458a09dec39f8bd5acfc6/medusa/init/filesystem.py#L32">medusa/init/filesystem.py</a>", line 32, in decode
    return text_type(value, 'utf-8' if os.name != 'nt' else fs_encoding)
UnicodeDecodeError: 'utf8' codec can't decode byte 0x92 in position 23: invalid start byte
</pre>
---
_STAFF NOTIFIED_: @pymedusa/support @pymedusa/moderators

Should be fixed with the new release. Let us know if it isn't.

### INFO
**Python Version**: `2.7.14 (default, May 28 2018, 14:47:18) [GCC 4.7.3 20130102 (prerelease)]`
**Operating System**: `Linux-3.10.105-x86_64-with-glibc2.2.5`
**Locale**: `None`
**Branch**: [master](../tree/master)
**Database**: `44.12`
**Commit**: pymedusa/Medusa@54da0c77d705a23f1ce67945ba4af3e1b978dcfc
**Link to Log**: https://gist.github.com/ca40ec17434063e254f1b07a047c4806
### ERROR
<pre>
2018-11-26 09:45:19 ERROR    SHOWQUEUE-ADD :: [54da0c7] Error searching dir for episodes: 'utf8' codec can't decode byte 0x92 in position 26: invalid start byte
Traceback (most recent call last):
  File "/volume1/@appstore/sickbeard-custom/var/SickBeard/<a href="../blob/54da0c77d705a23f1ce67945ba4af3e1b978dcfc/medusa/show_queue.py#L619">medusa/show_queue.py</a>", line 619, in run
    self.show.load_episodes_from_dir()
  File "/volume1/@appstore/sickbeard-custom/var/SickBeard/<a href="../blob/54da0c77d705a23f1ce67945ba4af3e1b978dcfc/medusa/tv/series.py#L994">medusa/tv/series.py</a>", line 994, in load_episodes_from_dir
    media_files = helpers.list_media_files(self.location)
  File "/volume1/@appstore/sickbeard-custom/var/SickBeard/<a href="../blob/54da0c77d705a23f1ce67945ba4af3e1b978dcfc/medusa/helpers/__init__.py#L262">medusa/helpers/__init__.py</a>", line 262, in list_media_files
    files += list_media_files(full_cur_file)
  File "/volume1/@appstore/sickbeard-custom/var/SickBeard/<a href="../blob/54da0c77d705a23f1ce67945ba4af3e1b978dcfc/medusa/helpers/__init__.py#L257">medusa/helpers/__init__.py</a>", line 257, in list_media_files
    for cur_file in os.listdir(path):
  File "/volume1/@appstore/sickbeard-custom/var/SickBeard/<a href="../blob/54da0c77d705a23f1ce67945ba4af3e1b978dcfc/medusa/init/filesystem.py#L112">medusa/init/filesystem.py</a>", line 112, in patched_output
    return handle_output(f(*args, **kwargs))
  File "/volume1/@appstore/sickbeard-custom/var/SickBeard/<a href="../blob/54da0c77d705a23f1ce67945ba4af3e1b978dcfc/medusa/init/filesystem.py#L49">medusa/init/filesystem.py</a>", line 49, in _handle_output_u
    return list(map(_handle_output_u, result))
  File "/volume1/@appstore/sickbeard-custom/var/SickBeard/<a href="../blob/54da0c77d705a23f1ce67945ba4af3e1b978dcfc/medusa/init/filesystem.py#L46">medusa/init/filesystem.py</a>", line 46, in _handle_output_u
    return decode(result)
  File "/volume1/@appstore/sickbeard-custom/var/SickBeard/<a href="../blob/54da0c77d705a23f1ce67945ba4af3e1b978dcfc/medusa/init/filesystem.py#L32">medusa/init/filesystem.py</a>", line 32, in decode
    return text_type(value, fs_encoding if valid_encoding else 'utf-8')
UnicodeDecodeError: 'utf8' codec can't decode byte 0x92 in position 26: invalid start byte
</pre>
---
_STAFF NOTIFIED_: @pymedusa/support @pymedusa/moderators

@medariox hmm? 
Yes, I still have the same error even after the new release. Happens only for one of the shows.
This can only happen if you are using non-UTF-8 encodings (e.g. latin1) in your OS and don't have the locale set (or not the correct one). In that case Medusa defaults to UTF-8 for Unix. You might have noticed a warning message at the start of Medusa. The easiest solution is to just set the encoding you are using for your files and folders. This is a generic tutorial on how to do it: https://www.shellhacks.com/linux-define-locale-language-settings/ but a quick Google search should also yield OS specific tutorials.
This is my Locale:
admin@NAS:~$ locale
LANG=en_US.utf8
LC_CTYPE="en_US.utf8"
LC_NUMERIC="en_US.utf8"
LC_TIME="en_US.utf8"
LC_COLLATE="en_US.utf8"
LC_MONETARY="en_US.utf8"
LC_MESSAGES="en_US.utf8"
LC_PAPER="en_US.utf8"
LC_NAME="en_US.utf8"
LC_ADDRESS="en_US.utf8"
LC_TELEPHONE="en_US.utf8"
LC_MEASUREMENT="en_US.utf8"
LC_IDENTIFICATION="en_US.utf8"
LC_ALL=en_US.utf8

I have this error with show Bull (2016).

File /volume1/@appstore/sickbeard-custom/var/SickBeard/medusa/init/filesystem.py:32, in decode:
return text_type(value, fs_encoding if valid_encoding else 'utf-8')
UnicodeDecodeError: 'utf8' codec can't decode byte 0x92 in position 26: invalid start byte

Nothing weird in the title, Sonarr works, but medusa keeps adding them to the download queue because it does not see the directory right. When clicking on the show icon:
Mako Error

A mako error has occured.
If this happened during an update a simple page refresh may be the solution.
Mako errors that happen during updates may be a one time error if there were significant ui changes.
@medariox My system is set to UTF-8.
```
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

```
It only happens for show Supernatural (2005), the rest is working. I have the Medusa installed on the OSMC Vero 4K, it is accessing the Synology NAS with the shows stored on it through NFS. I did the fresh installed of Medusa yesterday, using the latest Release. I got the warning about locales, so I did the `dpkg-reconfigure locales` and set it to UTF-8, rebooted, the message went away, but the problem is still there.
When does the error happen exactly? What do you do to trigger it?
@mcmikev
The problem is with one of the files contained in the show folder. Do you have any files with non-ASCII chars? Are you sure that these are UTF-8 encoded and not something else? Please post the name of the file that is causing the error.
Well the fun thing is that the files are already downloaded with sonar in the past. However Medusa does see the dir as a new show (when adding already show) but then cannot "see" in the directory
Example of file that keeps giving this error:
Bull (2016).S01E10.EJ WEBDL-1080p-Sonarr.mkv
There must be some non-ASCII char somewhere in the path... otherwise this error wouldn't happen. Probably hidden in the spaces or something.
@medariox for me it happened after I added existing show. And also I i rescan the show manually, unfortunatelly I cannot find on which file it fails, it just gives the error and trace. I went through the files and didn't see anything unusual. There are mostly just dots, dashes, brackets and square brackets in file names. Is there a way to find on which file it fails? I checked just the logs in the Web UI, is there some kind of debug mode?
@InToSSH 
Yes, you can enable debug logging in Gear > General > Advanced Settings
@medariox thank you, unfortunatelly debug didn't give me enough info aswell

```
2018-11-26 14:37:39 DEBUG    Thread_4 :: [54da0c7] 78901: Queueing show refresh for Supernatural
2018-11-26 14:37:40 INFO     SHOWQUEUE-REFRESH :: [54da0c7] 78901: Performing refresh on Supernatural
2018-11-26 14:37:40 DEBUG    SHOWQUEUE-REFRESH :: [54da0c7] 78901: Loading all episodes from the show directory: /mnt/nfs/htpc/Serialy/Supernatural
2018-11-26 14:37:46 ERROR    SHOWQUEUE-REFRESH :: [54da0c7] 78901: Error while refreshing show Supernatural. Error: 'utf8' codec can't decode byte 0x92 in position 46: invalid start byte
Traceback (most recent call last):
  File "/opt/medusa/medusa/show_queue.py", line 688, in run
    self.show.refresh_dir()
  File "/opt/medusa/medusa/tv/series.py", line 1741, in refresh_dir
    self.load_episodes_from_dir()
  File "/opt/medusa/medusa/tv/series.py", line 994, in load_episodes_from_dir
    media_files = helpers.list_media_files(self.location)
  File "/opt/medusa/medusa/helpers/__init__.py", line 262, in list_media_files
    files += list_media_files(full_cur_file)
  File "/opt/medusa/medusa/helpers/__init__.py", line 257, in list_media_files
    for cur_file in os.listdir(path):
  File "/opt/medusa/medusa/init/filesystem.py", line 112, in patched_output
    return handle_output(f(*args, **kwargs))
  File "/opt/medusa/medusa/init/filesystem.py", line 49, in _handle_output_u
    return list(map(_handle_output_u, result))
  File "/opt/medusa/medusa/init/filesystem.py", line 46, in _handle_output_u
    return decode(result)
  File "/opt/medusa/medusa/init/filesystem.py", line 32, in decode
    return text_type(value, fs_encoding if valid_encoding else 'utf-8')
  File "/usr/lib/python2.7/encodings/utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode byte 0x92 in position 46: invalid start byte

```

Does it look only for media files or the input to this function is all the files, because I haven't checked like .txt files.

EDIT: the 0x92 should be "smart quote (')", so at least I know what to look for.
Alright.. I have fixed it.
It was the weird `’` instead of `'` which is from windows-1252

So here is my solution, might help someone, I used this utility:
```
root@htpc-livingroom:/mnt/nfs/htpc/Serialy/Supernatural# convmv -r -f windows-1252 -t UTF-8 .
```
Which gave me list of files:

```
mv "./Season 12/Supernatural S12E05 (SDTV) [lol] - The One You▒ve Been Waiting For.mkv" "./Season 12/Supernatural S12E05 (SDTV) [lol] - The One You’ve Been Waiting For.mkv"
mv "./Season 04/Season_4/Supernatural S04E02 - Are You There, God. It▒s Me Dean Winches.avi"    "./Season 04/Season_4/Supernatural S04E02 - Are You There, God. It’s Me Dean Winches.avi"
mv "./Season 04/Season_4/Supernatural S04E02 - Are You There, God. It▒s Me Dean Winches.cs.srt" "./Season 04/Season_4/Supernatural S04E02 - Are You There, God. It’s Me Dean Winches.cs.srt"
mv "./Season 04/Season_4/Supernatural S04E02 - Are You There, God. It▒s Me Dean Winches.srt"    "./Season 04/Season_4/Supernatural S04E02 - Are You There, God. It’s Me Dean Winches.srt"
mv "./Season 11/Supernatural S11E12 (SDTV) [lol] - Don▒t You Forget about Me.mp4"       "./Season 11/Supernatural S11E12 (SDTV) [lol] - Don’t You Forget about Me.mp4"
mv "./Season 11/Supernatural S11E20 [lol] - Don▒t Call Me Shurley.mkv"  "./Season 11/Supernatural S11E20 [lol] - Don’t Call Me Shurley.mkv"
mv "./Season 11/Supernatural S11E12 [lol] - Don▒t You Forget about Me.mp4"      "./Season 11/Supernatural S11E12 [lol] - Don’t You Forget about Me.mp4"

```

Then after you make sure it would make the move to correct filename, you run the same command with `--notest` option, which makes the mv.
After that I ran the Rescan again and all went file.

@medariox maybe it would be nice to add some str_replace() before this function which fails for this particular \x92 character, which seems to be making most problems.

### INFO
**Python Version**: `2.7.14 (default, May 28 2018, 15:26:34) [GCC 4.3.2]`
**Operating System**: `Linux-2.6.32.12-ppc-with-glibc2.0`
**Locale**: `None`
**Branch**: [master](../tree/master)
**Database**: `44.12`
**Commit**: pymedusa/Medusa@918cfe7ce01808499585ffe6c1356fd5ed369f76
**Link to Log**: https://gist.github.com/8c24a35127f1923e910f84f6d2ee8c34
### ERROR
<pre>
2019-01-03 04:18:11 ERROR    SHOWQUEUE-REFRESH :: [918cfe7] 274431: Error while refreshing show Gotham. Error: 'utf8' codec can't decode byte 0x85 in position 56: invalid start byte
Traceback (most recent call last):
  File "/volume1/@appstore/sickbeard-custom/var/SickBeard/<a href="../blob/918cfe7ce01808499585ffe6c1356fd5ed369f76/medusa/show_queue.py#L688">medusa/show_queue.py</a>", line 688, in run
    self.show.refresh_dir()
  File "/volume1/@appstore/sickbeard-custom/var/SickBeard/<a href="../blob/918cfe7ce01808499585ffe6c1356fd5ed369f76/medusa/tv/series.py#L1741">medusa/tv/series.py</a>", line 1741, in refresh_dir
    self.load_episodes_from_dir()
  File "/volume1/@appstore/sickbeard-custom/var/SickBeard/<a href="../blob/918cfe7ce01808499585ffe6c1356fd5ed369f76/medusa/tv/series.py#L994">medusa/tv/series.py</a>", line 994, in load_episodes_from_dir
    media_files = helpers.list_media_files(self.location)
  File "/volume1/@appstore/sickbeard-custom/var/SickBeard/<a href="../blob/918cfe7ce01808499585ffe6c1356fd5ed369f76/medusa/helpers/__init__.py#L262">medusa/helpers/__init__.py</a>", line 262, in list_media_files
    files += list_media_files(full_cur_file)
  File "/volume1/@appstore/sickbeard-custom/var/SickBeard/<a href="../blob/918cfe7ce01808499585ffe6c1356fd5ed369f76/medusa/helpers/__init__.py#L257">medusa/helpers/__init__.py</a>", line 257, in list_media_files
    for cur_file in os.listdir(path):
  File "/volume1/@appstore/sickbeard-custom/var/SickBeard/<a href="../blob/918cfe7ce01808499585ffe6c1356fd5ed369f76/medusa/init/filesystem.py#L112">medusa/init/filesystem.py</a>", line 112, in patched_output
    return handle_output(f(*args, **kwargs))
  File "/volume1/@appstore/sickbeard-custom/var/SickBeard/<a href="../blob/918cfe7ce01808499585ffe6c1356fd5ed369f76/medusa/init/filesystem.py#L49">medusa/init/filesystem.py</a>", line 49, in _handle_output_u
    return list(map(_handle_output_u, result))
  File "/volume1/@appstore/sickbeard-custom/var/SickBeard/<a href="../blob/918cfe7ce01808499585ffe6c1356fd5ed369f76/medusa/init/filesystem.py#L46">medusa/init/filesystem.py</a>", line 46, in _handle_output_u
    return decode(result)
  File "/volume1/@appstore/sickbeard-custom/var/SickBeard/<a href="../blob/918cfe7ce01808499585ffe6c1356fd5ed369f76/medusa/init/filesystem.py#L32">medusa/init/filesystem.py</a>", line 32, in decode
    return text_type(value, fs_encoding if valid_encoding else 'utf-8')
UnicodeDecodeError: 'utf8' codec can't decode byte 0x85 in position 56: invalid start byte
</pre>
---
_STAFF NOTIFIED_: @pymedusa/support @pymedusa/moderators


### INFO
**Python Version**: `2.7.14 (default, May 28 2018, 15:26:34) [GCC 4.3.2]`
**Operating System**: `Linux-2.6.32.12-ppc-with-glibc2.0`
**Locale**: `None`
**Branch**: [master](../tree/master)
**Database**: `44.12`
**Commit**: pymedusa/Medusa@918cfe7ce01808499585ffe6c1356fd5ed369f76
**Link to Log**: https://gist.github.com/91e81eadde658847d275c636316a80eb
### ERROR
<pre>
2019-01-12 04:07:53 ERROR    SHOWQUEUE-REFRESH :: [918cfe7] 274431: Error while refreshing show Gotham. Error: 'utf8' codec can't decode byte 0x85 in position 56: invalid start byte
Traceback (most recent call last):
  File "/volume1/@appstore/sickbeard-custom/var/SickBeard/<a href="../blob/918cfe7ce01808499585ffe6c1356fd5ed369f76/medusa/show_queue.py#L688">medusa/show_queue.py</a>", line 688, in run
    self.show.refresh_dir()
  File "/volume1/@appstore/sickbeard-custom/var/SickBeard/<a href="../blob/918cfe7ce01808499585ffe6c1356fd5ed369f76/medusa/tv/series.py#L1741">medusa/tv/series.py</a>", line 1741, in refresh_dir
    self.load_episodes_from_dir()
  File "/volume1/@appstore/sickbeard-custom/var/SickBeard/<a href="../blob/918cfe7ce01808499585ffe6c1356fd5ed369f76/medusa/tv/series.py#L994">medusa/tv/series.py</a>", line 994, in load_episodes_from_dir
    media_files = helpers.list_media_files(self.location)
  File "/volume1/@appstore/sickbeard-custom/var/SickBeard/<a href="../blob/918cfe7ce01808499585ffe6c1356fd5ed369f76/medusa/helpers/__init__.py#L262">medusa/helpers/__init__.py</a>", line 262, in list_media_files
    files += list_media_files(full_cur_file)
  File "/volume1/@appstore/sickbeard-custom/var/SickBeard/<a href="../blob/918cfe7ce01808499585ffe6c1356fd5ed369f76/medusa/helpers/__init__.py#L257">medusa/helpers/__init__.py</a>", line 257, in list_media_files
    for cur_file in os.listdir(path):
  File "/volume1/@appstore/sickbeard-custom/var/SickBeard/<a href="../blob/918cfe7ce01808499585ffe6c1356fd5ed369f76/medusa/init/filesystem.py#L112">medusa/init/filesystem.py</a>", line 112, in patched_output
    return handle_output(f(*args, **kwargs))
  File "/volume1/@appstore/sickbeard-custom/var/SickBeard/<a href="../blob/918cfe7ce01808499585ffe6c1356fd5ed369f76/medusa/init/filesystem.py#L49">medusa/init/filesystem.py</a>", line 49, in _handle_output_u
    return list(map(_handle_output_u, result))
  File "/volume1/@appstore/sickbeard-custom/var/SickBeard/<a href="../blob/918cfe7ce01808499585ffe6c1356fd5ed369f76/medusa/init/filesystem.py#L46">medusa/init/filesystem.py</a>", line 46, in _handle_output_u
    return decode(result)
  File "/volume1/@appstore/sickbeard-custom/var/SickBeard/<a href="../blob/918cfe7ce01808499585ffe6c1356fd5ed369f76/medusa/init/filesystem.py#L32">medusa/init/filesystem.py</a>", line 32, in decode
    return text_type(value, fs_encoding if valid_encoding else 'utf-8')
UnicodeDecodeError: 'utf8' codec can't decode byte 0x85 in position 56: invalid start byte
</pre>
---
_STAFF NOTIFIED_: @pymedusa/support @pymedusa/moderators

### INFO
**Python Version**: `2.7.15 (default, Feb 12 2019, 11:00:12) [GCC 4.2.1 Compatible Apple LLVM 10.0.0 (clang-1000.11.45.5)]`
**Operating System**: `Darwin-18.2.0-x86_64-i386-64bit` (macOS 10.14.3)
**Locale**: `None`
**Branch**: [develop](../tree/develop)
**Database**: `44.14`
**Commit**: pymedusa/Medusa@94650a9f5367521a974759323b846d6cdeaa7eb4
**Link to Log**: 
[All Logs.zip](https://github.com/pymedusa/Medusa/files/2921704/All.Logs.zip)


timestamps may not match as there was no log for the error listed below as i only keep a max of 20 logs. & when this happened the old log was auto deleted by then. logs included have same errors though at different timestamps.

### ERROR
<pre>
2019-03-02 05:01:31 ERROR    SNATCHQUEUE-SNATCH-354170 :: [94650a9] qbittorrent: Unknown exception raised when sending torrent to qbittorrent: 'utf8' codec can't decode byte 0xfe in position 1022: invalid start byte
Traceback (most recent call last):
  File "/Users/ovidijus/Apps/Medusa/<a href="../blob/94650a9f5367521a974759323b846d6cdeaa7eb4/medusa/clients/torrent/generic.py#L82">medusa/clients/torrent/generic.py</a>", line 82, in _request
    cookies=cookies, timeout=120, verify=False)
  File "/Users/ovidijus/Apps/Medusa/<a href="../blob/94650a9f5367521a974759323b846d6cdeaa7eb4/medusa/session/core.py#L103">medusa/session/core.py</a>", line 103, in request
    timeout=timeout, verify=ssl_cert, **kwargs)
  File "/Users/ovidijus/Apps/Medusa/<a href="../blob/94650a9f5367521a974759323b846d6cdeaa7eb4/ext/requests/sessions.py#L533">ext/requests/sessions.py</a>", line 533, in request
    resp = self.send(prep, **send_kwargs)
  File "/Users/ovidijus/Apps/Medusa/<a href="../blob/94650a9f5367521a974759323b846d6cdeaa7eb4/ext/requests/sessions.py#L653">ext/requests/sessions.py</a>", line 653, in send
    r = dispatch_hook('response', hooks, r, **kwargs)
  File "/Users/ovidijus/Apps/Medusa/<a href="../blob/94650a9f5367521a974759323b846d6cdeaa7eb4/ext/requests/hooks.py#L31">ext/requests/hooks.py</a>", line 31, in dispatch_hook
    _hook_data = hook(hook_data, **kwargs)
  File "/Users/ovidijus/Apps/Medusa/<a href="../blob/94650a9f5367521a974759323b846d6cdeaa7eb4/medusa/session/hooks.py#L29">medusa/session/hooks.py</a>", line 29, in log_url
    text_body = ensure_text(request.body)
  File "/Users/ovidijus/Apps/Medusa/<a href="../blob/94650a9f5367521a974759323b846d6cdeaa7eb4/ext/six.py#L904">ext/six.py</a>", line 904, in ensure_text
    return s.decode(encoding, errors)
  File "/usr/local/Cellar/python@2/2.7.15_3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/encodings/utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xfe in position 1022: invalid start byte
</pre>
---
_STAFF NOTIFIED_: @pymedusa/support @pymedusa/moderators

@medariox

this is starting to get frustrating most of my torrent downloads are ending up Uncategorised because of these errors last one as under issue #6237 but now its a new one..
i have manually included logs. i believe this is a rare case error & only happening to some or torrents with extremely long names.

happens in both python2 & 3

also seems to be happening more on issue #5234 

edit i can reproduce this with any show.

EG: Magical Girl Spec-Ops Asuka
Scene Exception: Mahou Shoujo Tokushusen Asuka
Wanted Groups: HorribleSubs,Golumpa,Arukoru

did a manually search on EP 8.
chose provider nyaa.si (via Jackett) Horrible subs release. Torrent download & error occurs & doesnt send to Medusa Category on qbittorrent.

Running qBittorent 4.1.5 (64 bit)

refer to #5234 as error posts seem to be happing more there.

Screenshot: 
![screen shot 2019-03-02 at 3 09 02 pm](https://user-images.githubusercontent.com/2242880/53677005-ba35ef00-3cfd-11e9-9ab8-611d7add3ff1.jpg)

i feel like this is only happening via Jackett torrents not going into categories.

Seems to be only happening with any torrent snatched from Jackett.

Jackett is running on Mono: Mono JIT compiler version 5.18.0.240 (2018-08/5266e6a8f10 Tue Jan 15 21:54:10 EST 2019)

Parameters: --debug JackettConsole.exe --NoRestart

Release ver: Jackett Version 0.10.861.0

indexers setup:

```
1337x
anidex
animetosho
aniRena
btbit
btdb
btstornet
demonoid
digbt
ettv
extratorrent-ag
extratorrentclone
eztv
horriblesubs
idopeclone
ilcorsaronero
isohunt2
kickasstorrent
limetorrents
magnetdl
monova
nexttorrent
nyaa-pantsu
nyaasi
prostylex
rarbg
rutor
showrss
skytorrentsclone
solidtorrents
thepiratebay
tokyotosho
torlock
torrent9
torrentcouch
torrentdownloads
torrentfunk
torrentgalaxyorg
torrentproject2
torrentscsv
torrentz2
worldwidetorrents
yify
yts
zooqle
```

never had issues back on SC even on developer branch with Jackett surprised this is happening here...

also is this a Medusa only problem or should jackett dev look into this as well? - nothing found in jackett logs referencing these issues. seems medusa having phrasing issues from torrent data grabbed from jackett.

hope this is an easy fix as all my torrents from jackett aren't working atm due to wrong category being applied.

i'm using: nzbToMedia/TorrentToMedia.py "%D|%N|%L|%I" to process all my torrents & due to wrong category tag they won't process now.

### INFO
**Python Version**: `2.7.15 (default, Feb 12 2019, 11:00:12) [GCC 4.2.1 Compatible Apple LLVM 10.0.0 (clang-1000.11.45.5)]`
**Operating System**: `Darwin-18.2.0-x86_64-i386-64bit`
**Locale**: `None`
**Branch**: [develop](../tree/develop)
**Database**: `44.14`
**Commit**: pymedusa/Medusa@94650a9f5367521a974759323b846d6cdeaa7eb4
**Link to Log**: https://gist.github.com/3e421d986c0671c8ce2b330c59c44023
### ERROR
<pre>
2019-03-02 15:26:50 ERROR    SNATCHQUEUE-SNATCH-349309 :: [94650a9] qbittorrent: Unknown exception raised when sending torrent to qbittorrent: 'utf8' codec can't decode byte 0x99 in position 1488: invalid start byte
Traceback (most recent call last):
  File "/Users/ovidijus/Apps/Medusa/<a href="../blob/94650a9f5367521a974759323b846d6cdeaa7eb4/medusa/clients/torrent/generic.py#L82">medusa/clients/torrent/generic.py</a>", line 82, in _request
    cookies=cookies, timeout=120, verify=False)
  File "/Users/ovidijus/Apps/Medusa/<a href="../blob/94650a9f5367521a974759323b846d6cdeaa7eb4/medusa/session/core.py#L103">medusa/session/core.py</a>", line 103, in request
    timeout=timeout, verify=ssl_cert, **kwargs)
  File "/Users/ovidijus/Apps/Medusa/<a href="../blob/94650a9f5367521a974759323b846d6cdeaa7eb4/ext/requests/sessions.py#L533">ext/requests/sessions.py</a>", line 533, in request
    resp = self.send(prep, **send_kwargs)
  File "/Users/ovidijus/Apps/Medusa/<a href="../blob/94650a9f5367521a974759323b846d6cdeaa7eb4/ext/requests/sessions.py#L653">ext/requests/sessions.py</a>", line 653, in send
    r = dispatch_hook('response', hooks, r, **kwargs)
  File "/Users/ovidijus/Apps/Medusa/<a href="../blob/94650a9f5367521a974759323b846d6cdeaa7eb4/ext/requests/hooks.py#L31">ext/requests/hooks.py</a>", line 31, in dispatch_hook
    _hook_data = hook(hook_data, **kwargs)
  File "/Users/ovidijus/Apps/Medusa/<a href="../blob/94650a9f5367521a974759323b846d6cdeaa7eb4/medusa/session/hooks.py#L29">medusa/session/hooks.py</a>", line 29, in log_url
    text_body = ensure_text(request.body)
  File "/Users/ovidijus/Apps/Medusa/<a href="../blob/94650a9f5367521a974759323b846d6cdeaa7eb4/ext/six.py#L904">ext/six.py</a>", line 904, in ensure_text
    return s.decode(encoding, errors)
  File "/usr/local/Cellar/python@2/2.7.15_3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/encodings/utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode byte 0x99 in position 1488: invalid start byte
</pre>
---
_STAFF NOTIFIED_: @pymedusa/support @pymedusa/moderators


### INFO
**Python Version**: `3.7.2 (default, Feb 12 2019, 08:15:36) [Clang 10.0.0 (clang-1000.11.45.5)]`
**Operating System**: `Darwin-18.2.0-x86_64-i386-64bit`
**Locale**: `unknown`
**Branch**: [develop](../tree/develop)
**Database**: `44.14`
**Commit**: pymedusa/Medusa@94650a9f5367521a974759323b846d6cdeaa7eb4
**Link to Log**: https://gist.github.com/8920e00906045523997a4ad2623d0b77
### ERROR
<pre>
2019-03-02 15:33:25 ERROR    SNATCHQUEUE-SNATCH-349309 :: [94650a9] qbittorrent: Unknown exception raised when sending torrent to qbittorrent: 'utf-8' codec can't decode byte 0x99 in position 1488: invalid start byte
Traceback (most recent call last):
  File "/Users/ovidijus/Apps/Medusa/<a href="../blob/94650a9f5367521a974759323b846d6cdeaa7eb4/medusa/clients/torrent/generic.py#L82">medusa/clients/torrent/generic.py</a>", line 82, in _request
    cookies=cookies, timeout=120, verify=False)
  File "/Users/ovidijus/Apps/Medusa/<a href="../blob/94650a9f5367521a974759323b846d6cdeaa7eb4/medusa/session/core.py#L103">medusa/session/core.py</a>", line 103, in request
    timeout=timeout, verify=ssl_cert, **kwargs)
  File "/Users/ovidijus/Apps/Medusa/<a href="../blob/94650a9f5367521a974759323b846d6cdeaa7eb4/ext/requests/sessions.py#L533">ext/requests/sessions.py</a>", line 533, in request
    resp = self.send(prep, **send_kwargs)
  File "/Users/ovidijus/Apps/Medusa/<a href="../blob/94650a9f5367521a974759323b846d6cdeaa7eb4/ext/requests/sessions.py#L653">ext/requests/sessions.py</a>", line 653, in send
    r = dispatch_hook('response', hooks, r, **kwargs)
  File "/Users/ovidijus/Apps/Medusa/<a href="../blob/94650a9f5367521a974759323b846d6cdeaa7eb4/ext/requests/hooks.py#L31">ext/requests/hooks.py</a>", line 31, in dispatch_hook
    _hook_data = hook(hook_data, **kwargs)
  File "/Users/ovidijus/Apps/Medusa/<a href="../blob/94650a9f5367521a974759323b846d6cdeaa7eb4/medusa/session/hooks.py#L29">medusa/session/hooks.py</a>", line 29, in log_url
    text_body = ensure_text(request.body)
  File "/Users/ovidijus/Apps/Medusa/<a href="../blob/94650a9f5367521a974759323b846d6cdeaa7eb4/ext/six.py#L904">ext/six.py</a>", line 904, in ensure_text
    return s.decode(encoding, errors)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x99 in position 1488: invalid start byte
</pre>
---
_STAFF NOTIFIED_: @pymedusa/support @pymedusa/moderators


### INFO
**Python Version**: `3.7.2 (default, Feb 12 2019, 08:15:36) [Clang 10.0.0 (clang-1000.11.45.5)]`
**Operating System**: `Darwin-18.2.0-x86_64-i386-64bit`
**Locale**: `unknown`
**Branch**: [develop](../tree/develop)
**Database**: `44.14`
**Commit**: pymedusa/Medusa@94650a9f5367521a974759323b846d6cdeaa7eb4
**Link to Log**: https://gist.github.com/77faf033156ec8c00fe8d9fb3202c47e
### ERROR
<pre>
2019-03-02 16:18:14 ERROR    SNATCHQUEUE-SNATCH-354171 :: [94650a9] qbittorrent: Unknown exception raised when sending torrent to qbittorrent: 'utf-8' codec can't decode byte 0x81 in position 858: invalid start byte
Traceback (most recent call last):
  File "/Users/ovidijus/Apps/Medusa/<a href="../blob/94650a9f5367521a974759323b846d6cdeaa7eb4/medusa/clients/torrent/generic.py#L82">medusa/clients/torrent/generic.py</a>", line 82, in _request
    cookies=cookies, timeout=120, verify=False)
  File "/Users/ovidijus/Apps/Medusa/<a href="../blob/94650a9f5367521a974759323b846d6cdeaa7eb4/medusa/session/core.py#L103">medusa/session/core.py</a>", line 103, in request
    timeout=timeout, verify=ssl_cert, **kwargs)
  File "/Users/ovidijus/Apps/Medusa/<a href="../blob/94650a9f5367521a974759323b846d6cdeaa7eb4/ext/requests/sessions.py#L533">ext/requests/sessions.py</a>", line 533, in request
    resp = self.send(prep, **send_kwargs)
  File "/Users/ovidijus/Apps/Medusa/<a href="../blob/94650a9f5367521a974759323b846d6cdeaa7eb4/ext/requests/sessions.py#L653">ext/requests/sessions.py</a>", line 653, in send
    r = dispatch_hook('response', hooks, r, **kwargs)
  File "/Users/ovidijus/Apps/Medusa/<a href="../blob/94650a9f5367521a974759323b846d6cdeaa7eb4/ext/requests/hooks.py#L31">ext/requests/hooks.py</a>", line 31, in dispatch_hook
    _hook_data = hook(hook_data, **kwargs)
  File "/Users/ovidijus/Apps/Medusa/<a href="../blob/94650a9f5367521a974759323b846d6cdeaa7eb4/medusa/session/hooks.py#L29">medusa/session/hooks.py</a>", line 29, in log_url
    text_body = ensure_text(request.body)
  File "/Users/ovidijus/Apps/Medusa/<a href="../blob/94650a9f5367521a974759323b846d6cdeaa7eb4/ext/six.py#L904">ext/six.py</a>", line 904, in ensure_text
    return s.decode(encoding, errors)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x81 in position 858: invalid start byte
</pre>
---
_STAFF NOTIFIED_: @pymedusa/support @pymedusa/moderators


### INFO
**Python Version**: `3.6.7 (default, Oct 22 2018, 11:32:17) [GCC 8.2.0]`
**Operating System**: `Linux-4.18.0-16-generic-x86_64-with-Ubuntu-18.04-bionic`
**Locale**: `UTF-8`
**Branch**: [master](../tree/master)
**Database**: `44.14`
**Commit**: pymedusa/Medusa@b34f1df336e52cf0a690acbc393440ac9f8b3581
**Link to Log**: https://gist.github.com/ddda5a1f6a0b6d545f42b132df57a7f9
### ERROR
<pre>
2019-04-01 09:30:01 ERROR    Thread_0 :: [b34f1df] Exception generated: 'utf-8' codec can't decode byte 0x95 in position 0: invalid start byte
Traceback (most recent call last):
  File "/opt/**********/**********/server/web/core/base.py", line 262, in async_call
    result = function(**kwargs)
  File "/opt/**********/**********/server/web/core/error_logs.py", line 149, in viewlog
    return t.render(log_lines='\n'.join(data),
  File "/opt/**********/**********/server/web/core/error_logs.py", line 143, in <genexpr>
    data = (html_escape(line) for line in read_loglines(modification_time=modification_time, formatter=text_type, max_lines=max_lines,
  File "/opt/**********/**********/logger/__init__.py", line 166, in read_loglines
    for line in reverse_readlines(f):
  File "/opt/**********/**********/logger/__init__.py", line 278, in reverse_readlines
    lines = block.decode(encoding).split(newline)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x95 in position 0: invalid start byte
</pre>
---
_STAFF NOTIFIED_: @pymedusa/support @pymedusa/moderators


### INFO
**Python Version**: `3.7.3rc1 (default, Mar 13 2019, 11:01:15) [GCC 8.2.0]`
**Operating System**: `Linux-4.9.35-v7+-armv7l-with-debian-buster-sid`
**Locale**: `UTF-8`
**Branch**: [develop](../tree/develop)
**Database**: `44.14`
**Commit**: pymedusa/Medusa@9cdb57a32df1a8b1520b8a7dd732b6f01498483e
**Link to Log**: https://gist.github.com/a7677bafd09bb008e5a020ee29b2b878
### ERROR
<pre>
2019-04-11 23:13:09 ERROR    Thread_11 :: [9cdb57a] Exception generated: 'utf-8' codec can't decode byte 0x9b in position 0: invalid start byte
Traceback (most recent call last):
  File "/home/pi/Medusa/<a href="../blob/9cdb57a32df1a8b1520b8a7dd732b6f01498483e/medusa/server/web/core/base.py#L262">medusa/server/web/core/base.py</a>", line 262, in async_call
    result = function(**kwargs)
  File "/home/pi/Medusa/<a href="../blob/9cdb57a32df1a8b1520b8a7dd732b6f01498483e/medusa/server/web/core/error_logs.py#L149">medusa/server/web/core/error_logs.py</a>", line 149, in viewlog
    return t.render(log_lines='\n'.join(data),
  File "/home/pi/Medusa/<a href="../blob/9cdb57a32df1a8b1520b8a7dd732b6f01498483e/medusa/server/web/core/error_logs.py#L143">medusa/server/web/core/error_logs.py</a>", line 143, in <genexpr>
    data = (html_escape(line) for line in read_loglines(modification_time=modification_time, formatter=text_type, max_lines=max_lines,
  File "/home/pi/Medusa/<a href="../blob/9cdb57a32df1a8b1520b8a7dd732b6f01498483e/medusa/logger/__init__.py#L166">medusa/logger/__init__.py</a>", line 166, in read_loglines
    for line in reverse_readlines(f):
  File "/home/pi/Medusa/<a href="../blob/9cdb57a32df1a8b1520b8a7dd732b6f01498483e/medusa/logger/__init__.py#L278">medusa/logger/__init__.py</a>", line 278, in reverse_readlines
    lines = block.decode(encoding).split(newline)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x9b in position 0: invalid start byte
</pre>
---
_STAFF NOTIFIED_: @pymedusa/support @pymedusa/moderators


### INFO
**Python Version**: `2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:53:40) [MSC v.1500 64 bit (AMD64)]`
**Operating System**: `Windows-10-10.0.17763`
**Locale**: `cp1252`
**Branch**: [master](../tree/master)
**Database**: `44.14`
**Commit**: pymedusa/Medusa@f46bfacf8763204fbde4f26a5916095371d494d1
**Link to Log**: https://gist.github.com/a957f2c3ba91a4eea04d8527854da7cd
### ERROR
<pre>
2019-04-18 18:31:21 ERROR    Thread_16 :: [f46bfac] Exception generated: 'utf8' codec can't decode byte 0xb5 in position 0: invalid start byte
Traceback (most recent call last):
  File "C:\Program Files\Medusa\Medusa\<a href="../blob/f46bfacf8763204fbde4f26a5916095371d494d1/medusa/server/web/core/base.py#L262">medusa\server\web\core\base.py</a>", line 262, in async_call
    result = function(**kwargs)
  File "C:\Program Files\Medusa\Medusa\<a href="../blob/f46bfacf8763204fbde4f26a5916095371d494d1/medusa/server/web/core/error_logs.py#L149">medusa\server\web\core\error_logs.py</a>", line 149, in viewlog
    return t.render(log_lines='\n'.join(data),
  File "C:\Program Files\Medusa\Medusa\<a href="../blob/f46bfacf8763204fbde4f26a5916095371d494d1/medusa/server/web/core/error_logs.py#L143">medusa\server\web\core\error_logs.py</a>", line 143, in <genexpr>
    data = (html_escape(line) for line in read_loglines(modification_time=modification_time, formatter=text_type, max_lines=max_lines,
  File "C:\Program Files\Medusa\Medusa\<a href="../blob/f46bfacf8763204fbde4f26a5916095371d494d1/medusa/logger/__init__.py#L166">medusa\logger\__init__.py</a>", line 166, in read_loglines
    for line in reverse_readlines(f):
  File "C:\Program Files\Medusa\Medusa\<a href="../blob/f46bfacf8763204fbde4f26a5916095371d494d1/medusa/logger/__init__.py#L278">medusa\logger\__init__.py</a>", line 278, in reverse_readlines
    lines = block.decode(encoding).split(newline)
  File "C:\Program Files\Medusa\Python\lib\encodings\utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xb5 in position 0: invalid start byte
</pre>
---
_STAFF NOTIFIED_: @pymedusa/support @pymedusa/moderators

@medariox you have a clue? Else I ask user to zip his Logs folder.

Probably similar to what this 
user reported  https://github.com/pymedusa/Medusa/issues/5463#issuecomment-441648118.

But then in ligs

Resolving patch:
diff --git a/medusa/logger/__init__.py b/medusa/logger/__init__.py
--- a/medusa/logger/__init__.py
+++ b/medusa/logger/__init__.py
@@ -203,7 +203,7 @@ def read_loglines(log_file=None, modification_time=None, start_index=0, max_line
                 yield formatter(logline)
 
 
-def blocks_r(filename, size=64 * 1024, reset_offset=True):
+def blocks_r(filename, size=64 * 1024, reset_offset=True, encoding='utf-8'):
     """
     Yields the data within a file in reverse-ordered blocks of given size.
 
@@ -222,12 +222,15 @@ def blocks_r(filename, size=64 * 1024, reset_offset=True):
         reset_offset (bool): Reset the file offset.
             If True, starts reading from the end of the file.
             Otherwise, starts reading from where the file current position is.
+        encoding (str|None): The encoding for correct block size computation.
+            If `str`, must be a valid string encoding.
+            If None, the default encoding is used.
 
     Yields:
-        block (bytes): The data within the blocks.
+        block (str): The data within the blocks.
 
     """
-    with io.open(filename, 'rb') as file_obj:
+    with io.open(filename, 'r', encoding=encoding) as file_obj:
         offset = 0
         if reset_offset:
             file_size = remaining_size = file_obj.seek(0, os.SEEK_END)
@@ -272,10 +275,11 @@ def reverse_readlines(filename, skip_empty=True, append_newline=False, block_siz
     newline = '\n'
     empty = ''
     remainder = empty
-    block_generator_kws = dict(size=block_size, reset_offset=reset_offset)
+    block_generator_kws = dict(size=block_size, reset_offset=reset_offset,
+                               encoding=encoding)
     block_generator = blocks_r
     for block in block_generator(filename, **block_generator_kws):
-        lines = block.decode(encoding).split(newline)
+        lines = block.split(newline)
         if remainder:
             lines[-1] = lines[-1] + remainder
         remainder = lines[0]


Test patch: