Skip to content

Commit

Permalink
Merge branch 'master' into rurban/mime-base64-utf8-take2-gh813+gh814
Browse files Browse the repository at this point in the history
  • Loading branch information
Reini Urban committed Oct 1, 2012
2 parents 7bb6f30 + bd6851e commit b21352c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 2 additions & 0 deletions ChangeLog
Expand Up @@ -26,6 +26,8 @@
- Documentation
+ Cleaned up removed parrot cmdline options -D/-O/-v from --help output and
running.pod [GH #838]
- Tools
+ Improved gdb pretty-printing for multi-byte strings
- Tests
- Community

Expand Down
12 changes: 11 additions & 1 deletion tools/dev/gdb-pp.py
Expand Up @@ -155,6 +155,11 @@ def _parrot_str_to_str(val):
"""
encoding = val['encoding'].dereference()
encoding_name = encoding['name'].string()
name = encoding_name + ':'
if name == 'ascii:':
name = ''
if name == 'iso-8859-1:':
name = ''
length = val['bufused']

# See http://docs.python.org/library/codecs.html#standard-encodings
Expand All @@ -164,4 +169,9 @@ def _parrot_str_to_str(val):
encoding_name='utf_16'
if encoding_name == 'ucs4':
encoding_name=='utf_32'
return val['strstart'].string(encoding=encoding_name,length=length)
if name == '':
return val['strstart'].string(encoding=encoding_name,errors='replace',length=length)
else:
return '%s%s [%d/%d]' % \
(name, val['strstart'].string(encoding=encoding_name,errors='replace',length=length), \
val['strlen'], length)

0 comments on commit b21352c

Please sign in to comment.