In the execnb.nbio.write_nb function, the file encoding is not specified as UTF-8 to Path().read_text(), while it is specified elsewhere in execnb.nbio. With certain notebooks this can result in the following error when the default system encoding is not UTF-8 (e.g. Windows):
Traceback (most recent call last):
[...]
File "C:\Users\ralfg\miniconda3\lib\site-packages\execnb\nbio.py", line 94, in write_nb
old = Path(path).read_text() if path.exists() else None
File "C:\Users\ralfg\miniconda3\lib\pathlib.py", line 1267, in read_text
return f.read()
File "C:\Users\ralfg\miniconda3\lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 48369: character maps to <undefined>
On the following line, the encoding should be specified as UTF-8:
https://github.com/fastai/execnb/blob/931e4113973502af91ac4287b537aeaf06ad4181/execnb/nbio.py#L94