mirror of
https://github.com/f-droid/fdroidserver.git
synced 2026-10-24 05:00:48 -04:00
metadata: fix text wrapping on unicode characters
We were passing the utf-8 encoded string to textwrap, which took the bytes as characters. Hence multi-byte unicode characters (in utf-8) would count as multiple columns, which is clearly wrong.
This commit is contained in:
1 parent
309660423c
commit
0cf2539c89
1 file changed
+4
-3
@@ -525,9 +525,10 @@ class DescriptionFormatter:
|
||||
self.state = self.stNONE
|
||||
whole_para = ' '.join(self.para_lines)
|
||||
self.addtext(whole_para)
|
||||
self.text.write(textwrap.fill(whole_para, 80,
|
||||
break_long_words=False,
|
||||
break_on_hyphens=False))
|
||||
wrapped = textwrap.fill(whole_para.decode('utf-8'), 80,
|
||||
break_long_words=False,
|
||||
break_on_hyphens=False)
|
||||
self.text.write(wrapped.encode('utf-8'))
|
||||
self.html.write('</p>')
|
||||
del self.para_lines[:]
|
||||
|
||||
|
||||
Reference in new issue
Block a user