Karim shoair commited on
Commit
01fef5c
·
1 Parent(s): 8d941c2

fix(shell): Fix `view` command edge case

Browse files
Files changed (1) hide show
  1. scrapling/core/shell.py +2 -2
scrapling/core/shell.py CHANGED
@@ -317,8 +317,8 @@ def show_page_in_browser(page: Selector): # pragma: no cover
317
 
318
  try:
319
  fd, fname = make_temp_file(prefix="scrapling_view_", suffix=".html")
320
- with open(fd, "wb") as f:
321
- f.write(page.body)
322
 
323
  open_in_browser(f"file://{fname}")
324
  except IOError as e:
 
317
 
318
  try:
319
  fd, fname = make_temp_file(prefix="scrapling_view_", suffix=".html")
320
+ with open(fd, "w", encoding=page.encoding) as f:
321
+ f.write(page.html_content)
322
 
323
  open_in_browser(f"file://{fname}")
324
  except IOError as e: