Home > Software engineering >  How to make search of list with none english letters?
How to make search of list with none english letters?

Time:06-29

I am making e-commerce website on ( React.js - client )and ( Python Django - client ). I am trying to make a search feature for list of all products and the queries are none-english. Whenever I try to search, my none-english query gets into hell knows what. For example I input query "текст" and it turns to / search / текст. Expected: / search / текст. How my requests go on client side..

And of course my api cannot find any product with this query..

@api_view(["GET"]) 
def searchData(request, q):
  searchedData = Product.objects.filter(Q(title__icontains=q))
  data = ProductSerializer(searchedData, many=True).data
  return Response(data)

This is my search view.

path('search/<str:q>/', views.searchData)

This is my path.

I hope for any kind of help. Thanks!

CodePudding user response:

The текст in fact is текст, but is url encoded, you have to decode it. You can verify this on this page https://www.urldecoder.io/

  • Related