Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(417)

Unified Diff: tools/grit/grit/tool/xmb.py

Issue 2697383002: Fix xmb_unittest.py in GRIT. (Closed)
Patch Set: Correct sequence for \U00110000. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/grit/grit/tool/xmb_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/grit/grit/tool/xmb.py
diff --git a/tools/grit/grit/tool/xmb.py b/tools/grit/grit/tool/xmb.py
index 0e7950ccde1e237eec79b5e115ff9d7e95ce26f1..c25dbf143d1a3c2bfbc5d2c8054578336800940a 100755
--- a/tools/grit/grit/tool/xmb.py
+++ b/tools/grit/grit/tool/xmb.py
@@ -28,11 +28,6 @@ _XML_QUOTE_ESCAPES = {
u"'": u''',
u'"': u'"',
}
-# See http://www.w3.org/TR/xml/#charsets
-_XML_BAD_CHAR_REGEX = lazy_re.compile(u'[^\u0009\u000A\u000D'
- u'\u0020-\uD7FF\uE000-\uFFFD'
- u'\U00010000-\U0010FFFF]')
-
def _XmlEscape(s):
"""Returns text escaped for XML in a way compatible with Google's
@@ -41,12 +36,7 @@ def _XmlEscape(s):
"""
if not type(s) == unicode:
s = unicode(s)
- result = saxutils.escape(s, _XML_QUOTE_ESCAPES)
- illegal_chars = _XML_BAD_CHAR_REGEX.search(result)
- if illegal_chars:
- raise Exception('String contains characters disallowed in XML: %s' %
- repr(result))
- return result.encode('utf-8')
+ return saxutils.escape(s, _XML_QUOTE_ESCAPES).encode('utf-8')
def _WriteAttribute(file, name, value):
« no previous file with comments | « no previous file | tools/grit/grit/tool/xmb_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698