[resolved] Unicode Tags & Python API

Question 1: Are Unicode Tags Officially supported?
It looks like it, because I have a user who is tagging media with Korean ( ?? ) and it’s displaying just fine in the KMC.

However, when doing my “Get Related Videos” search - which uses tags, the API blows up with an ASCII encoding error:

Module KalturaClient.Plugins.Core, line 13375, in toParams
Module KalturaClient.Base, line 123, in addStringIfDefined
Module KalturaClient.Base, line 87, in put
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-1: ordinal not in range(128)

The problem is pretty obvious when you see the code: KalturaClient.Base.KalturaParams in the put() method:

Provide the value u’??’

self.params[key] = str(value)

And you will blow up.

Before I dig deeper and submit a fix on github, I want to know if anyone else has run into this?

-Flip

I don’t know about python, but I do know that in the past the java client had the same issue of not doing UTF8 encoding

So most likely it’s a bug in the client library

Cool. I’m going to wrap up the ‘low hanging fruit’ on my current project still. This is an ‘annoyance’ right now, not a full blown showstopper for me.

I’ll swing back around here with a test case, fix, and pull request probably early next week. Unless someone else wants to jump on it and save me the work :slight_smile:

The test is to use the Python API and:

  1. create a media type (video), and add a tag to it with unicode (you can use the value " ?? " for your tag)
  2. Then, search for that video using the same tag

Step 1 might break also - I don’t know yet. The videos in question were created on the KMC, not via the API.

My problem is specifically getting a video, retrieving it’s tags (which are of type unicode), then using those tags to search for “related” videos. it’s the search that breaks.

Resolved on IX-9.16.0 Thanks for accepting the pull request.

Cool. I’m going to wrap up the ‘low hanging fruit’ on my current project still. This is an ‘annoyance’ right now, not a full blown showstopper for me.

I’ll swing back around here with a test case, fix, and pull request probably early next week. Unless someone else wants to jump on it and save me the work :slight_smile:

The test is to use the Python API and:

  1. create a media type (video), and add a tag to it with unicode (you can use the value " ?? " for your tag)
  2. Then, search for that video using the same tag

Step 1 might break also - I don’t know yet. The videos in question were created on the KMC, not via the API.

My problem is specifically getting a video, retrieving it’s tags (which are of type unicode), then using those tags to search for “related” videos. it’s the search that breaks.

Resolved on IX-9.16.0 Thanks for accepting the pull request.