about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authortoonn <toonn@toonn.io>2021-08-27 19:51:54 +0200
committertoonn <toonn@toonn.io>2021-08-27 19:51:54 +0200
commitc72830dda410523fd70db04d88412d3d00821e21 (patch)
treeedd6904e15bff7018b422dd96a7b99a3030ba5e2
parent61a51cd31470dff52d11043054f5e38812a9dc77 (diff)
downloadranger-c72830dda410523fd70db04d88412d3d00821e21.tar.gz
metadata: Switch to open23, forcing UTF-8 for the metadata file
-rw-r--r--ranger/core/metadata.py9
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:
173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409