'icontains and query with Umlaut

My Product database mostly consists of a number and a json field:

class Product(models.Model):
    data        = models.JSONField()
    number      = models.PositiveIntegerField()

The data attribute looks like:

data = {"name": "Würfel", "price": 20,
        "name": "truffels", "price": 1.20, }

Now the query:

products = Product.objects.all()
r = products.filter(Q(data__icontains = "ürf")) 

results in an empty query, while

r = products.filter(Q(data__icontains = "fel")) 

gives back results - this happens for all Umlaute. How can I address this?

I face this issue on mariadb.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source