Ввод «C++» в поле ввода, мой скрипт Python получает только «c».Ввод FieldStorage удаляет некоторые символы
Вот HTML код:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="es" lang="es">
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
</head>
<body>
<input id="inputtxt" type="text">
<a onclick="window.location='escapetest.py?q='+document.getElementById('inputtxt').value;">Go!</a>
</body>
</html>
И сценарий питона, который получает запрос:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import cgitb; cgitb.enable()
from cgi import FieldStorage
inputstr = FieldStorage()["q"]
print "Content-Type: text/html; charset=utf-8"
print
print inputstr.value
Выход:
с
Запуск Python 2.7 (x64) и использование Firefox.
Спасибо дружище, это работает! – cdonts