Skip to content

Commit 9b3fdb1

Browse files
author
tailor
committed
[project @ UTF-8 encode unicode values in seqToKV]
1 parent 63aaee5 commit 9b3fdb1

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎openid/kvform.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ def seqToKV(seq, strict=False):
99
key:value pairs. The pairs are generated in the order given.
1010
1111
@param seq: The pairs
12-
@type seq: [(str, str)]
12+
@type seq: [(str, (unicode|str))]
1313
1414
@return: A string representation of the sequence
1515
@rtype: str
@@ -38,6 +38,8 @@ def err(msg):
3838
if k.strip() != k:
3939
err('Key has whitespace at beginning or end: %r' % k)
4040

41+
if isinstance(v, types.UnicodeType):
42+
v = v.encode('UTF8')
4143
if not isinstance(v, types.StringType):
4244
err('Converting value to string: %r' % v)
4345
v = str(v)

0 commit comments

Comments
 (0)