我想用 unicode 字符搜索一些东西,比如ŞÇİÖÜ
我定义了一个这样的搜索函数:
def search(request):
from django.db.models import Q
q = request.GET.get("search", "")
k = q.split()
list=[]
for i in k:
query = Q(title__icontains=i) | Q(content__icontains=i)
posts = Post.objects.filter(query).distinct().order_by('date')
list.append(posts)
total = 0
if list[0]:
total += len(list)
return render_to_response('search_results.html', RequestContext(request, {
"list": list,
"q": q,
"total": total,
}))
我有LANGUAGE_CODE = "UTF-8"
。当我想搜索'Şeker Öçü'
它时,它什么也不返回,尽管我有şeker öçü
帖子。