Recursive directory creation for unit registry cache
Discovered in PR #494 that the user cache directory does not work in Windows. This seems to be because the `os.mkdir()` function used in  `units.prepare_cache_file_path()` does not create nested directories. Instead, `os.makedirs()` should be used.
diff --git a/bindings/python/triplestore/units.py b/bindings/python/triplestore/units.py
index 92b262b2..dc8d97af 100644
--- a/bindings/python/triplestore/units.py
+++ b/bindings/python/triplestore/units.py
@@ -63,7 +63,7 @@ def prepare_cache_file_path(filename: str) -> str:
     """Return cache file name."""
     cache_directory = user_cache_dir("dlite")
     if not os.path.exists(cache_directory):
-        os.mkdir(cache_directory)
+        os.makedirs(cache_directory)
     return os.path.join(cache_directory, filename)
 
 
@@ -81,11 +81,11 @@ def get_pint_registry(sources=('qudt', ), force_recreate=False) -> UnitRegistry:
     """
     registry_file_path = prepare_cache_file_path("pint_unit_registry.txt")
     if force_recreate or not os.path.exists(registry_file_path):
-        with open(registry_file_path, "w") as f:
+        with open(registry_file_path, "w", encoding="utf8") as f:
             f.write("\\n".join(pint_prefix_lines()) + "\\n")
         for source in sources:
             pint_registry_lines = pint_registry_lines_from_qudt()
-            with open(registry_file_path, "a") as f:
+            with open(registry_file_path, "a", encoding="utf8") as f:
                 f.write("\\n".join(pint_registry_lines) + "\\n")
 
     ureg = UnitRegistry(registry_file_path)
['bindings/python/triplestore/units.py']