Skip to content

Commit

Permalink
Merge pull request #487 from kargm/groovy-devel
Browse files Browse the repository at this point in the history
Fix for Python3.2 compatibility
  • Loading branch information
dirk-thomas committed Jul 24, 2013
2 parents 644910c + 016109c commit 827cf5e
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions python/catkin/tidy_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,22 @@
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.

from __future__ import unicode_literals
import codecs
import os
import re

# unit test suites are not good about screening out illegal unicode characters (#603)
# recipe from http://boodebr.org/main/python/all-about-python-and-unicode#UNI_XML
# code copied from rosunit/src/junitxml.py
RE_XML_ILLEGAL = u'([\u0000-\u0008\u000b-\u000c\u000e-\u001f\ufffe-\uffff])' + \
u'|' + \
u'([%s-%s][^%s-%s])|([^%s-%s][%s-%s])|([%s-%s]$)|(^[%s-%s])' % \
(unichr(0xd800), unichr(0xdbff), unichr(0xdc00), unichr(0xdfff),
unichr(0xd800), unichr(0xdbff), unichr(0xdc00), unichr(0xdfff),
unichr(0xd800), unichr(0xdbff), unichr(0xdc00), unichr(0xdfff))


RE_XML_ILLEGAL = '([\u0000-\u0008\u000b-\u000c\u000e-\u001f\ufffe-\uffff])' + \
'|' + \
'([%s-%s][^%s-%s])|([^%s-%s][%s-%s])|([%s-%s]$)|(^[%s-%s])' % \
(unichr(0xd800), unichr(0xdbff), unichr(0xdc00), unichr(0xdfff),
unichr(0xd800), unichr(0xdbff), unichr(0xdc00), unichr(0xdfff),
unichr(0xd800), unichr(0xdbff), unichr(0xdc00), unichr(0xdfff))
_SAFE_XML_REGEX = re.compile(RE_XML_ILLEGAL)


Expand Down

0 comments on commit 827cf5e

Please sign in to comment.