diff --git a/crawl4ai/crawler_strategy.py b/crawl4ai/crawler_strategy.py index 168d21df..85ba4450 100644 --- a/crawl4ai/crawler_strategy.py +++ b/crawl4ai/crawler_strategy.py @@ -256,7 +256,7 @@ class LocalSeleniumCrawlerStrategy(CrawlerStrategy): # Store in cache cache_file_path = os.path.join(Path.home(), ".crawl4ai", "cache", url_hash) - with open(cache_file_path, "w") as f: + with open(cache_file_path, "w", encoding="utf-8") as f: f.write(html) if self.verbose: diff --git a/docs/examples/llm_extraction_openai_pricing.py b/docs/examples/llm_extraction_openai_pricing.py index c4c6943e..9330ad31 100644 --- a/docs/examples/llm_extraction_openai_pricing.py +++ b/docs/examples/llm_extraction_openai_pricing.py @@ -36,5 +36,5 @@ model_fees = json.loads(result.extracted_content) print(len(model_fees)) -with open(".data/data.json", "w") as f: +with open(".data/data.json", "w", encoding="utf-8") as f: f.write(result.extracted_content) \ No newline at end of file diff --git a/docs/examples/summarize_page.py b/docs/examples/summarize_page.py index 31098e8e..85158999 100644 --- a/docs/examples/summarize_page.py +++ b/docs/examples/summarize_page.py @@ -42,5 +42,5 @@ page_summary = json.loads(result.extracted_content) print(page_summary) -with open(".data/page_summary.json", "w") as f: +with open(".data/page_summary.json", "w", encoding="utf-8") as f: f.write(result.extracted_content) diff --git a/docs/md/examples/llm_extraction.md b/docs/md/examples/llm_extraction.md index 5336a3cf..b7805726 100644 --- a/docs/md/examples/llm_extraction.md +++ b/docs/md/examples/llm_extraction.md @@ -45,7 +45,7 @@ model_fees = json.loads(result.extracted_content) print(len(model_fees)) -with open(".data/data.json", "w") as f: +with open(".data/data.json", "w", encoding="utf-8") as f: f.write(result.extracted_content) ``` @@ -71,7 +71,7 @@ model_fees = json.loads(result.extracted_content) print(len(model_fees)) -with open(".data/data.json", "w") as f: +with open(".data/data.json", "w", encoding="utf-8") as f: f.write(result.extracted_content) ``` diff --git a/docs/md/examples/summarization.md b/docs/md/examples/summarization.md index 3210fad6..b817f691 100644 --- a/docs/md/examples/summarization.md +++ b/docs/md/examples/summarization.md @@ -91,7 +91,7 @@ This example demonstrates how to use `Crawl4AI` to extract a summary from a web Save the extracted data to a file for further use. ```python - with open(".data/page_summary.json", "w") as f: + with open(".data/page_summary.json", "w", encoding="utf-8") as f: f.write(result.extracted_content) ```