hi, i use AutocompleteWidget for some of my field in db like this:
dbMysql.qbp_video.game.widget = SQLFORM.widgets.autocomplete(request,
dbMysql.qbp_gameindex.title, limitby=(0,30), min_length=4)
everything is ok,till I search a none englis word like "تست" (this is
a persian text) in this case autocomplete dose not work, because of
"escape" function use in javascript, the input text converted to
somthing like this "%u0645%u06CC%u0631%u0645" a unicode text.
to solve this issue i change some code in sqlhtml.py in gluon:
in AutocompleteWidget function around the line of 526:
def callback(self):
if self.keyword in self.request.vars:
field = self.fields[0]
strSearch = self.request.vars[self.keyword]
strSearch = unicode(strSearch.replace('%', '\\'), "utf-8")
strSearch = strSearch.decode('unicode_escape')
rows = self.db(field.like(strSearch + '%'))\
.select(orderby=self.orderby,limitby=self.limitby,*self.fields)
so i add strSearch variable and do some stuff to get it work
correctly.
now i want to know is this the only way to solve this issue? is it
correct way or i have security issue by doing this?
thanks
p.s: sorry for my bad english