# django-rest\_framework not accept unicode characters

**URL:** <https://forum.djangoproject.com/t/django-rest-framework-not-accept-unicode-characters/18203>\
**Category:** Forms & APIs\
**Created:** [January 14, 2023, 3:51pm UTC](https://forum.djangoproject.com/t/django-rest-framework-not-accept-unicode-characters/18203 "2023-01-14T15:51:53Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mohamadalkavmi](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/mohamadalkavmi/32/11736_2.png) [@Mohamadalkavmi](https://forum.djangoproject.com/u/Mohamadalkavmi)\
**Post date:** [January 14, 2023, 3:51pm UTC](https://forum.djangoproject.com/t/django-rest-framework-not-accept-unicode-characters/18203/1 "2023-01-14T15:51:53Z")

</div>

I created api view for my mobile app which must accept words for search , when user enter none English words send error in the server this:

# Internal Error

The server encountered an unexpected condition which prevented it from fulfilling the request.

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [January 14, 2023, 3:58pm UTC](https://forum.djangoproject.com/t/django-rest-framework-not-accept-unicode-characters/18203/2 "2023-01-14T15:58:51Z")

</div>

Your server logs should have the complete traceback. You want to examine those first to identify exactly where the problem is occurring.

---

<div class="post-metadata">

**Author:** ![Mohamadalkavmi](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/mohamadalkavmi/32/11736_2.png) [@Mohamadalkavmi](https://forum.djangoproject.com/u/Mohamadalkavmi)\
**Post date:** [January 14, 2023, 4:20pm UTC](https://forum.djangoproject.com/t/django-rest-framework-not-accept-unicode-characters/18203/3 "2023-01-14T16:20:54Z")

</div>

only when send non English letter this happen

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [January 14, 2023, 4:48pm UTC](https://forum.djangoproject.com/t/django-rest-framework-not-accept-unicode-characters/18203/4 "2023-01-14T16:48:28Z")

</div>

I understand that. But you need to find what code is causing it to fail in that circumstance so you know where to look. If you don’t know where the problem is, you can’t fix it.

---

<div class="post-metadata">

**Author:** ![Mohamadalkavmi](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/mohamadalkavmi/32/11736_2.png) [@Mohamadalkavmi](https://forum.djangoproject.com/u/Mohamadalkavmi)\
**Post date:** [January 14, 2023, 4:54pm UTC](https://forum.djangoproject.com/t/django-rest-framework-not-accept-unicode-characters/18203/5 "2023-01-14T16:54:10Z")

</div>

here are def  
def VideosearchAPI(request,ser ):

sql =“SELECT \* FROM dashboard\_image,dashboard\_imagescategory ,dashboard\_medias WHERE (dashboard\_image.category\_id=dashboard\_imagescategory.id) AND (dashboard\_medias.id=dashboard\_imagescategory.medias\_id) AND (dashboard\_medias.id=2) AND title LIKE '%”+ser+"%’ "  
queryset = Image.objects.raw(sql)  
qs\_json = serialize(‘json’, queryset)  
return HttpResponse(qs\_json, content\_type=‘application/json’)

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [January 14, 2023, 5:02pm UTC](https://forum.djangoproject.com/t/django-rest-framework-not-accept-unicode-characters/18203/6 "2023-01-14T17:02:23Z")

</div>

Side note: When you post code here, please enclose the code between lines of three backtick - ` characters. This means you’ll have a line of ```, then your code, then another line of ```. This forces the forum software to keep your code properly formatted.

Side note #2: You have created an SQL-injection vulnerability. A malicious user could delete data from your database because of how you’ve written this. You _really_ should be using the ORM for this query.

Side note #3: There’s nothing you are showing here that appears to be using DRF at all. This looks like a standard Django view to me. (Other than the malformed query)

You still need to post the complete traceback that you’re receiving from this error.

It would also help if you included a sample of the data that was being submitted that causes the error.
