From fbfefbf83d1396db1ea4095b2b64e1841689b364 Mon Sep 17 00:00:00 2001 From: Malcolm Tredinnick Date: Mon, 14 May 2007 16:06:27 +0000 Subject: unicode: Changed a few more places in newforms where str() was being used with potential non-ASCII arguments. Refs #3406 (and added a test for the latter). git-svn-id: http://code.djangoproject.com/svn/django/branches/unicode@5236 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- tests/regressiontests/forms/regressions.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'tests') diff --git a/tests/regressiontests/forms/regressions.py b/tests/regressiontests/forms/regressions.py index c5a94db6f9..caa0f68741 100644 --- a/tests/regressiontests/forms/regressions.py +++ b/tests/regressiontests/forms/regressions.py @@ -36,4 +36,14 @@ Unicode decoding problems... >>> f = SomeForm() >>> f.as_p() u'

' + +Testing choice validation with UTF-8 bytestrings as input (these are the +Russian abbreviations "мес." and "шт.". + +>>> UNITS = (('\xd0\xbc\xd0\xb5\xd1\x81.', '\xd0\xbc\xd0\xb5\xd1\x81.'), ('\xd1\x88\xd1\x82.', '\xd1\x88\xd1\x82.')) +>>> f = ChoiceField(choices=UNITS) +>>> f.clean(u'\u0448\u0442.') +u'\u0448\u0442.' +>>> f.clean('\xd1\x88\xd1\x82.') +u'\u0448\u0442.' """ -- cgit v1.2.1