Fix unicode handling in 'View HTML code as formated text'. Fixes #667 #679
No reviewers
Labels
No Label
bug
build
dependencies
developers
documentation
duplicate
enhancement
formatting
invalid
legal
mobile
obsolete
packaging
performance
protocol
question
refactoring
regression
security
test
translation
usability
wontfix
No Milestone
No project
No Assignees
1 Participants
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: Bitmessage/PyBitmessage-2024-12-03#679
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "htmlfix"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Implemented like in main view (
def tableWidgetInboxItemClicked(self)
) except for substitution logic.Seems fine to me as is, however there are some tiny performance improvements that can be made.
In the first for loop change the string literals to unicode literals. When operating on a string and unicode string the string is converted to unicode. Since the if tests are being performed on every line if there are 100 lines the string literals are being converted to unicode 100 times.
These other improvements don't really have anything to do with this fix but while we are talking about this section of code:
content = u''.join(lines)
content.replace
call is useless as all new lines were removed in the split operation to make the lines list. Since it has been useless for some time it can be safely removed. However if it is actually supposed to do something then maybe changing the join I suggested above tou'<br>'.join(lines)
might achieve the desired outcome.Thank you for your input! With regards to the performance I've decided that late unicode decoding would work better. And you're right, double newlines weren't handled properly, so I've tried to implement original logic.
A better solution than I suggested. Good work.