Skip to content

Commit a3a0ab2

Browse files
authored
fix: use explicitly UTF-8 encoding in local storage (#533)
- All occurrences should be updated. - Closes: #532
1 parent 530caa0 commit a3a0ab2

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/crawlee/memory_storage_client/_dataset_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ async def _persist_dataset_items_to_disk(
350350
# Save all the new items to the disk
351351
for idx, item in data:
352352
file_path = os.path.join(entity_directory, f'{idx}.json')
353-
f = await asyncio.to_thread(open, file_path, mode='w')
353+
f = await asyncio.to_thread(open, file_path, mode='w', encoding='utf-8')
354354
try:
355355
s = await json_dumps(item)
356356
await asyncio.to_thread(f.write, s)

src/crawlee/memory_storage_client/_request_queue_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ async def _persist_single_request_to_storage(
477477

478478
# Write the request to the file
479479
file_path = os.path.join(entity_directory, f'{request.id}.json')
480-
f = await asyncio.to_thread(open, file_path, mode='w')
480+
f = await asyncio.to_thread(open, file_path, mode='w', encoding='utf-8')
481481
try:
482482
s = await json_dumps(request.model_dump())
483483
await asyncio.to_thread(f.write, s)

0 commit comments

Comments
 (0)