I am trying to make an html page which will have an interaction with a SQL database.I am using python as language and bottle+pymysql . I want my form to accept greek characters , so I can put them into the variables and later use them for my database.I am using accept charset in my form but not sure what it does and it does't work , too.
For example,I would like something like this name = 'ΟΝΟΜΑ' surname = 'ΕΠΙΘΕΤΟ'
My code works for english input , but my database contains only greek so it's a real need.
@app.route('/b1') # or @route('/login')
def b1():
return '''
<form action="/b1" method="post" accept-charset="foobar utt-8" >
Name : <input name="name" type="text" /><br>
Surname : <input name="surname" type="text" /><br>
Birth Year-From: <input name="from" type="text" /><br>
Birth Year-To : <input name="to" type="text" /><br>
<input value="Submit" type="submit" />
</form>
'''
@app.post('/b1',method='POST') # or @route('/login', method='POST')
def do_b1():
name = request.forms.get('name')
surname = request.forms.get('surname')
dfrom = request.forms.get('from')
dto = request.forms.get('to')
try:
query = '...'
curs.execute(query)
except:
yield "\n Failed to get data from base<br/>"
yield name
yield surname
yield dfrom
yield dto