specify encoding to ensure Python reads file as UTF-8
Browse filesexecuting `python whisper_fastapi_online_server.py --host 0.0.0.0 --port 8000` resulted in error on my setup for me:
```
whisper_streaming_web\whisper_fastapi_online_server.py, line 47, in <module>
html = f.read()
^^^^^^^^
File "C:\Python312\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 0x8f in position 1818: character maps to <undefined>
```
On Windows, Python defaults to the `cp1252` encoding, which may not match the encoding of the file being read.
Files containing special characters, non-ASCII text, or saved with UTF-8 encoding can trigger this error when read without specifying the correct encoding.
@@ -43,7 +43,7 @@ args = parser.parse_args()
|
|
43 |
asr, tokenizer = backend_factory(args)
|
44 |
|
45 |
# Load demo HTML for the root endpoint
|
46 |
-
with open("src/live_transcription.html", "r") as f:
|
47 |
html = f.read()
|
48 |
|
49 |
|
|
|
43 |
asr, tokenizer = backend_factory(args)
|
44 |
|
45 |
# Load demo HTML for the root endpoint
|
46 |
+
with open("src/live_transcription.html", "r", encoding="utf-8") as f:
|
47 |
html = f.read()
|
48 |
|
49 |
|