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

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -