python - how to print the value of an unicode string contained in a variable -
i'm using python 2.7 , want print value of field receive on server through form.
i type andré
field name
.
name = request.form['stripebillingname']
how print value of variable name
in readable encoding? want print andré
, not andr\xe9
in source header can declare
#!/usr/bin/env python # -*- coding: utf-8 -*- ....
after can use utf-8, should give desirable format
name = request.form['stripebillingname'] namedec = name.decode('utf8') print namedec
you can encode want e.g:
nameenc = namedec.encode('cp1250')
Comments
Post a Comment