Skip to content

Commit 49341ee

Browse files
docs: add encoding parameter to glossary create with csv example in README, and note about opening CSVs with byte order mark (BOM)
1 parent 0ae6a28 commit 49341ee

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,9 @@ specify the CSV data as `csv_data` either as a file-like object or string or
272272
bytes containing file content:
273273

274274
```python
275-
with open('/path/to/glossary_file.csv', 'r') as csv_file:
275+
# Open the CSV file assuming UTF-8 encoding. If your file contains a BOM,
276+
# consider using encoding='utf-8-sig' instead.
277+
with open('/path/to/glossary_file.csv', 'r', encoding='utf-8') as csv_file:
276278
csv_data = csv_file.read() # Read the file contents as a string
277279
my_csv_glossary = translator.create_glossary_from_csv(
278280
"CSV glossary",

0 commit comments

Comments
 (0)