Browse Source

Fix unicode handling in filter metadata match

tags/nilmtools-1.1.10^0
Jim Paris 9 years ago
parent
commit
c76d527f95
1 changed files with 5 additions and 1 deletions
  1. +5
    -1
      src/filter.py

+ 5
- 1
src/filter.py View File

@@ -236,8 +236,12 @@ class Filter(object):
metadata = self._client_dest.stream_get_metadata(self.dest.path)
if not self.force_metadata:
for key in data:
wanted = str(data[key])
wanted = data[key]
val = metadata.get(key, wanted)
# Force UTF-8 encoding for comparison and display
wanted = wanted.encode('utf-8')
val = val.encode('utf-8')
key = key.encode('utf-8')
if val != wanted and self.dest.rows > 0:
m = "Metadata in destination stream:\n"
m += " %s = %s\n" % (key, val)


Loading…
Cancel
Save