Skip to content

Commit

Permalink
fix #3836, teste correctement la présence de caractères unicode de pl…
Browse files Browse the repository at this point in the history
…us de 3 bytes (#3857)
  • Loading branch information
vhf authored and GerardPaligot committed Oct 16, 2016
1 parent e19d169 commit 2fe667f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion zds/utils/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,5 @@ def contains_utf8mb4(s):
"""
if not isinstance(s, unicode):
s = unicode(s, 'utf-8')
return not all(len(c.encode('utf-8')) <= 3 for c in s)
re_pattern = re.compile(u'[^\u0000-\uD7FF\uE000-\uFFFF]', re.UNICODE)
return s != re_pattern.sub(u'\uFFFD', s)
File renamed without changes.

0 comments on commit 2fe667f

Please sign in to comment.