Skip to content

Commit

Permalink
fix: use explicitly UTF-8 encoding in local storage (#533)
Browse files Browse the repository at this point in the history
- All occurrences should be updated.
- Closes: #532
  • Loading branch information
vdusek authored Sep 19, 2024
1 parent 530caa0 commit a3a0ab2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/crawlee/memory_storage_client/_dataset_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ async def _persist_dataset_items_to_disk(
# Save all the new items to the disk
for idx, item in data:
file_path = os.path.join(entity_directory, f'{idx}.json')
f = await asyncio.to_thread(open, file_path, mode='w')
f = await asyncio.to_thread(open, file_path, mode='w', encoding='utf-8')
try:
s = await json_dumps(item)
await asyncio.to_thread(f.write, s)
Expand Down
2 changes: 1 addition & 1 deletion src/crawlee/memory_storage_client/_request_queue_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ async def _persist_single_request_to_storage(

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

0 comments on commit a3a0ab2

Please sign in to comment.