Repository: mne-tools/mne-bids

Issue:
UTF-8 Encoding is not respected by make_dataset_description
### Description of the problem

Given the wide use of `encoding=utf-8-sig` in mne-bids, I assume that the example below is a bug, and `mne-bids` does want to support characters like ł  ([latin small letter with stroke](https://www.compart.com/en/unicode/U+0142)) that appear in some people's names




### Steps to reproduce

```Python
import tempfile
from pathlib import Path

import mne_bids

text = "Michał is a name that includes the character ł."
with tempfile.TemporaryDirectory() as temp_dir:
    mne_bids.make_dataset_description(
        path=temp_dir,
        name=text,
        authors=["Michał"],
    )
    with Path(f"{temp_dir}/dataset_description.json").open(encoding="utf-8") as fid:
        dataset_description = fid.read()
    # this works
    with Path("./test.txt").open("w", encoding="utf-8") as temp_file:
        temp_file.write(text)
    with Path("./test.txt").open("r", encoding="utf-8") as temp_file:
        expected_text = temp_file.read()

print("WHAT MNE BIDS WROTE TO DATASET_DESCRIPTION.JSON:")
print(dataset_description)
print(" ")
print(f"WHAT I WOULD EXPECT: {expected_text}")
```


### Expected results

`WHAT I WOULD EXPECT: Michał is a name that includes the character ł.`

### Actual results

```
{
    "Name": "Micha\u0142 is a name that includes the character \u0142.",
    "BIDSVersion": "1.7.0",
    "DatasetType": "raw",
    "Authors": [
        "Micha\u0142"
    ]
}
```
### Additional information

I took a quick look at the code but haven't figured out yet what is going wrong ☹️ 

Discussion:
codecov[bot]: ## [Codecov](https://app.codecov.io/gh/mne-tools/mne-bids/pull/1357?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mne-tools) Report
All modified and coverable lines are covered by tests :white_check_mark:
> Project coverage is 97.36%. Comparing base [(`3492fa0`)](https://app.codecov.io/gh/mne-tools/mne-bids/commit/3492fa01157d921f77b93ea31a4db192c47d3bb0?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mne-tools) to head [(`d96b16a`)](https://app.codecov.io/gh/mne-tools/mne-bids/commit/d96b16aa0f1780a78c627a0d9fedefacd03f00db?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mne-tools).

<details><summary>Additional details and impacted files</summary>


```diff
@@            Coverage Diff             @@
##             main    #1357      +/-   ##
==========================================
- Coverage   97.42%   97.36%   -0.06%     
==========================================
  Files          40       40              
  Lines        8918     8921       +3     
==========================================
- Hits         8688     8686       -2     
- Misses        230      235       +5     
```

</details>

[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/mne-tools/mne-bids/pull/1357?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mne-tools).   
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mne-tools).


Patch:
diff --git a/doc/whats_new.rst b/doc/whats_new.rst
index b685cd3c..456af029 100644
--- a/doc/whats_new.rst
+++ b/doc/whats_new.rst
@@ -23,6 +23,7 @@ The following authors had contributed before. Thank you for sticking around! 
 
 * `Stefan Appelhoff`_
 * `Daniel McCloy`_
+* `Scott Huberty`_
 
 Detailed list of changes
 ~~~~~~~~~~~~~~~~~~~~~~~~
@@ -47,6 +48,7 @@ Detailed list of changes
 ^^^^^^^^^^^^
 
 - :func:`mne_bids.read_raw_bids` can optionally return an ``event_id`` dictionary suitable for use with :func:`mne.events_from_annotations`, and if a ``values`` column is present in ``events.tsv`` it will be used as the source of the integer event ID codes, by `Daniel McCloy`_ (:gh:`1349`)
+- :func:`mne_bids.make_dataset_description` now correctly encodes the dataset description as UTF-8 on disk, by `Scott Huberty`_ (:gh:`1357`)
 
 ⚕️ Code health
 ^^^^^^^^^^^^^^
diff --git a/mne_bids/utils.py b/mne_bids/utils.py
index 49abf6ef..da0f7066 100644
--- a/mne_bids/utils.py
+++ b/mne_bids/utils.py
@@ -233,7 +233,7 @@ def _write_json(fname, dictionary, overwrite=False):
             f'"{fname}" already exists. Please set overwrite to True.'
         )
 
-    json_output = json.dumps(dictionary, indent=4)
+    json_output = json.dumps(dictionary, indent=4, ensure_ascii=False)
     with open(fname, "w", encoding="utf-8") as fid:
         fid.write(json_output)
         fid.write("\n")


Test patch:
diff --git a/mne_bids/tests/test_write.py b/mne_bids/tests/test_write.py
index a22252dd..623c869d 100644
--- a/mne_bids/tests/test_write.py
+++ b/mne_bids/tests/test_write.py
@@ -376,7 +376,7 @@ def test_make_dataset_description(tmp_path, monkeypatch):
     make_dataset_description(
         path=tmp_path,
         name="tst2",
-        authors="MNE B., MNE P.",
+        authors="MNE B., MNE P., MNE Ł.",
         funding="GSOC2019, GSOC2021",
         references_and_links="https://doi.org/10.21105/joss.01896",
         dataset_type="derivative",
@@ -386,7 +386,14 @@ def test_make_dataset_description(tmp_path, monkeypatch):
 
     with open(op.join(tmp_path, "dataset_description.json"), encoding="utf-8") as fid:
         dataset_description_json = json.load(fid)
-        assert dataset_description_json["Authors"] == ["MNE B.", "MNE P."]
+        assert dataset_description_json["Authors"] == ["MNE B.", "MNE P.", "MNE Ł."]
+        # If the text on disk is unicode, json.load will convert it. So let's test that
+        # the text was encoded correctly on disk.
+        fid.seek(0)
+        # don't use json.load here, as it will convert unicode to str
+        dataset_description_string = fid.read()
+        # Check that U+0141 was correctly encoded as Ł on disk
+        assert "MNE Ł." in dataset_description_string
 
     # Check we raise warnings and errors where appropriate
     with pytest.raises(