Skip to content

this line is breaking on unicode strings #869

@teamblubee

Description

@teamblubee

self._data_cache.set('search_query', json.dumps({'query': quote(query)}))

I fixed this issue on my local machine but a recent update broke it again.
When you have the query as non ascii it will break. This happens when I try to search the plugin for strings not in ascii.

typically the errors look like this

                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <type 'exceptions.KeyError'>
                                            Error Contents: u'\u6211'
                                            Traceback (most recent call last):
                                              File "/home/.kodi/addons/plugin.video.youtube/resources/lib/default.py", line 15, in <module>
                                                runner.run(__provider__)
                                              File "/home/.kodi/addons/plugin.video.youtube/resources/lib/youtube_plugin/kodion/runner.py", line 60, in run
                                                __RUNNER__.run(provider, context)
                                              File "/home/.kodi/addons/plugin.video.youtube/resources/lib/youtube_plugin/kodion/impl/xbmc/xbmc_runner.py", line 33, in run
                                                results = provider.navigate(context)
                                              File "/home/.kodi/addons/plugin.video.youtube/resources/lib/youtube_plugin/kodion/abstract_provider.py", line 104, in navigate
                                                result = method(context, re_match)

The quickest fix is just to add this unicode encode to the strings before sending it to the query.

            query = query.encode('utf-8')
            self._data_cache.set('search_query', json.dumps({'query': quote(query)}))^M

Hopefully this is a easy fix.

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