@@ -157,7 +157,7 @@ def get(self, key: str, default):
157
157
"""
158
158
path = self ._getvaluepath (key )
159
159
try :
160
- with path .open ("r" ) as f :
160
+ with path .open ("r" , encoding = "UTF-8" ) as f :
161
161
return json .load (f )
162
162
except (ValueError , OSError ):
163
163
return default
@@ -184,9 +184,9 @@ def set(self, key: str, value: object) -> None:
184
184
return
185
185
if not cache_dir_exists_already :
186
186
self ._ensure_supporting_files ()
187
- data = json .dumps (value , indent = 2 )
187
+ data = json .dumps (value , ensure_ascii = False , indent = 2 )
188
188
try :
189
- f = path .open ("w" )
189
+ f = path .open ("w" , encoding = "UTF-8" )
190
190
except OSError :
191
191
self .warn ("cache could not write path {path}" , path = path , _ispytest = True )
192
192
else :
@@ -196,7 +196,7 @@ def set(self, key: str, value: object) -> None:
196
196
def _ensure_supporting_files (self ) -> None :
197
197
"""Create supporting files in the cache dir that are not really part of the cache."""
198
198
readme_path = self ._cachedir / "README.md"
199
- readme_path .write_text (README_CONTENT )
199
+ readme_path .write_text (README_CONTENT , encoding = "UTF-8" )
200
200
201
201
gitignore_path = self ._cachedir .joinpath (".gitignore" )
202
202
msg = "# Created by pytest automatically.\n *\n "
0 commit comments