John
John

Reputation: 4038

form return strange character

My template is

<form method="GET" action="....">
                    <input type="submit" name="golfsite" value="1net" />
                    <input type="submit" name="golfsite" value="Golfagora" />
                    <input type="submit" name="golfsite" value="Juchi" />
</form>

views.py is

def affiliate(request, golfsite=None):

    golfsite = golfsite or request.args.get('golfsite')


    ......

On debug mode console, if I type 'golfsite' to check what is golfsite, it returns u'1net' or u'Golfagora' or u'juchi'. What is happening? What is u, Why doesnt it return 1net or golfagora or juchi.

Upvotes: 1

Views: 69

Answers (1)

Martijn Pieters
Martijn Pieters

Reputation: 1123240

You are getting Unicode strings, which is normal. This is not a problem. Django has decoded incoming form data to Python unicode strings based on the encoding used. This is normal behaviour.

Please do read up on Python and Unicode in the Python Unicode HOWTO to avoid future confusion.

Upvotes: 1

Related Questions