I’m trying to build a simple page using fast html python , inside REPLIT, to send a single carachter with submit button and to get the decimal UNicode value… the method .encode() seems not work…please, some help..
the code:
from fasthtml.common import FastHTML, serve, Div, H1, P
from fasthtml.common import *
app = FastHTML()
carattere=“”
app.get(“/”)
def home():
return Main(H1(‘UNICODE Processor’),
Div(len(carattere), “;”,carattere.encode()),
A(“Link to Page 2 (to add messages)”, href=“/page2”))
app.get(“/page2”)
def page2():
return Main(P(“Add a message with the form below:”),
Form(Input(type=“text”, name=“car”),
Button(“Submit”),
action=“/”, method=“post”))
u/app.post(“/”)
def codifica(car:str):
global carattere
carattere=car
return home()
if _name_ == “_main_”:
serve()