﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
18340	formtools.utils.form_hmac is not consistent with unicode input	Claude Paroz	nobody	"This problem can only be reproduced with cPickle. When feeding the django.contrib.formtools.utils.form_hmac function with Unicode values, stripping the leading/ending spaces produces different pickled results than the unstripped identical values. Here is an output of the two form_hmac passes in the !FormHmacTests.test_textfield_hash when you convert form values to Unicode:
{{{
(Pdb) p data, pickled
([('name', u'joe'), ('bio', u'Nothing notable.')], '\x80\x02]q\x01(U\x04nameq\x02X\x03\x00\x00\x00joeq\x03\x86q\x04U\x03bioq\x05X\x10\x00\x00\x00Nothing notable.q\x06\x86q\x07e.')

(Pdb) p data, pickled
([('name', u'joe'), ('bio', u'Nothing notable.')], '\x80\x02]q\x01(U\x04nameq\x02X\x03\x00\x00\x00joe\x86q\x03U\x03bioq\x04X\x10\x00\x00\x00Nothing notable.q\x05\x86q\x06e.')
}}}

Possible workarounds:
 * use the (slower) pickle module only, as I don't think the performance penalty will be noticeable in this part of the code
 * encode all unicode values to 'utf-8' (smart_str) before feeding them to pickle.dumps
 * feed repr(data) to pickle.dumps"	Bug	closed	contrib.formtools	dev	Normal	fixed			Accepted	1	0	0	0	0	0
