diff options
author | toonn <toonn@toonn.io> | 2021-08-27 19:51:54 +0200 |
---|---|---|
committer | toonn <toonn@toonn.io> | 2021-08-27 19:51:54 +0200 |
commit | c72830dda410523fd70db04d88412d3d00821e21 (patch) | |
tree | edd6904e15bff7018b422dd96a7b99a3030ba5e2 /ranger | |
parent | 61a51cd31470dff52d11043054f5e38812a9dc77 (diff) | |
download | ranger-c72830dda410523fd70db04d88412d3d00821e21.tar.gz |
metadata: Switch to open23, forcing UTF-8 for the metadata file
Diffstat (limited to 'ranger')
-rw-r--r-- | ranger/core/metadata.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/ranger/core/metadata.py b/ranger/core/metadata.py index 75f7ba3c..833d6e3e 100644 --- a/ranger/core/metadata.py +++ b/ranger/core/metadata.py @@ -15,6 +15,7 @@ from __future__ import (absolute_import, division, print_function) import copy from os.path import join, dirname, exists, basename +from ranger.ext.open23 import open23 from ranger.ext.openstruct import DefaultOpenStruct as ostruct @@ -26,9 +27,9 @@ class MetadataManager(object): def __init__(self): # metadata_cache maps filenames to dicts containing their metadata - self.metadata_cache = dict() + self.metadata_cache = {} # metafile_cache maps .metadata.json filenames to their entries - self.metafile_cache = dict() + self.metafile_cache = {} self.deep_search = DEEP_SEARCH_DEFAULT def reset(self): @@ -84,7 +85,7 @@ class MetadataManager(object): self.metadata_cache[filename] = entry self.metafile_cache[metafile] = entries - with open(metafile, "w") as fobj: + with open23(metafile, "w") as fobj: json.dump(entries, fobj, check_circular=True, indent=2) def _get_entry(self, filename): @@ -117,7 +118,7 @@ class MetadataManager(object): return self.metafile_cache[metafile] if exists(metafile): - with open(metafile, "r") as fobj: + with open23(metafile, "r") as fobj: try: entries = json.load(fobj) except ValueError: |