Merge pull request #84 from ernstchan/bugfixes

File name truncation done before conversion to HTML entities.
Minor code cleanup in various places.
Merge pull request #85 from ernstchan/minor-changes

Minor code cleanup in various places.
Encoding fix for reloaded posts on /ö/.