dgtlmoon / changedetection.io

The best and simplest free open source web page change detection, website watcher, restock monitor and notification service. Restock Monitor, change detection. Designed for simplicity - Simply monitor which websites had a text change for free. Free Open source web page change detection, Website defacement monitoring, Price change notification
https://changedetection.io
Apache License 2.0
17.3k stars 965 forks source link

Encoding format error ,Encoding format needs to be specified #2568

Closed smallDragonOne closed 1 month ago

smallDragonOne commented 2 months ago

environment: windows language: Python 3.12.0, file: content_fetchers/base.py

I don't know why python3, here does not use utf-8 encoding to read by default

error message: ERROR | changedetectionio.update_worker:run:481 - 'gbk' codec can't decode byte 0x8c in position 2900: illegal multibyte sequence

it work after change,here

before change: self.xpath_element_js = importlib.resources.files("changedetectionio.content_fetchers.res").joinpath('xpath_element_scraper.js').read_text() self.instock_data_js = importlib.resources.files("changedetectionio.content_fetchers.res").joinpath('stock-not-in-stock.js').read_text()

After change: self.xpath_element_js = importlib.resources.files("changedetectionio.content_fetchers.res").joinpath('xpath_element_scraper.js').read_text('utf-8') self.instock_data_js = importlib.resources.files("changedetectionio.content_fetchers.res").joinpath('stock-not-in-stock.js').read_text('utf-8')

dgtlmoon commented 1 month ago

thanks for that!