Bugfix: handle filenames that end in spaces or tabs

These are perfectly cromulent POSIX.
Handle non-UTF-8 filenames gracefully

Fixes

    Traceback (most recent call last):
      File "/usr/lib/pov-server-page/du2webtreemap", line 173, in <module>
        main()
      File "/usr/lib/pov-server-page/du2webtreemap", line 165, in main
        data = "var tree = %s" % format_json(json_data)
      File "/usr/lib/python2.7/json/__init__.py", line 231, in dumps
        return _default_encoder.encode(obj)
      File "/usr/lib/python2.7/json/encoder.py", line 201, in encode
        chunks = self.iterencode(o, _one_shot=True)
      File "/usr/lib/python2.7/json/encoder.py", line 264, in iterencode
        return _iterencode(o, 0)
    UnicodeDecodeError: 'utf8' codec can't decode byte 0xe9 in position 1: invalid continuation byte