Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 #3700

Open
7 tasks done
Gamewalker opened this issue Jan 28, 2025 · 0 comments
Open
7 tasks done

[Bug]: UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 #3700

Gamewalker opened this issue Jan 28, 2025 · 0 comments

Comments

@Gamewalker
Copy link

I Have A Problem With:

A specific source, The integration in general

What's Your Problem

Hello,

ICS looks like:

BEGIN:VEVENT
UID:papiertonne-2025-03-18
DTSTART:20250318
DTEND:20250318
DTSTAMP:20250128T115820
SUMMARY:Papiertonne
SEQUENCE:0
STATUS:CONFIRMED
CREATED:20250128T115820
ORGANIZER:StadtWerke Rösrath
TRANSP:TRANSPARENT
X-MICROSOFT-CDO-BUSYSTATUS:FREE
END:VEVENT

I think the "ö" in "ORGANIZER:StadtWerke Rösrath" is the problem, any advice how to fix it?

Source (if relevant)

https://www.stadtwerke-roesrath.de/wp-admin/admin-ajax.php?action=swr_download_ics&street=hahnenberg&bins%5B%5D=&bins%5B%5D=26089&bins%5B%5D=26088&bins%5B%5D=26087&bins%5B%5D=26086&date=Tue+Jan+28+2025+13%3A57%3A21+GMT%2B0100+%28Mitteleurop%C3%A4ische+Normalzeit%29

Logs

2025-01-28 13:40:58.534 ERROR (SyncWorker_2) [custom_components.waste_collection_schedule.waste_collection_schedule.source_shell] fetch failed for source ICS:
Traceback (most recent call last):
  File "/config/custom_components/waste_collection_schedule/waste_collection_schedule/source_shell.py", line 158, in fetch
    entries: Iterable[Collection] = self._source.fetch()
                                    ~~~~~~~~~~~~~~~~~~^^
  File "/config/custom_components/waste_collection_schedule/waste_collection_schedule/source/ics.py", line 207, in fetch
    return self.fetch_url(self._url, self._params)
           ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/waste_collection_schedule/waste_collection_schedule/source/ics.py", line 235, in fetch_url
    return self._convert(r.text)
           ~~~~~~~~~~~~~^^^^^^^^
  File "/config/custom_components/waste_collection_schedule/waste_collection_schedule/source/ics.py", line 250, in _convert
    dates = self._ics.convert(data)
  File "/config/custom_components/waste_collection_schedule/waste_collection_schedule/service/ICS.py", line 49, in convert
    start=start_date, end=end_date, string_content=ics_data.encode("utf-8").decode("ascii")
                                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 308: ordinal not in range(128)

Relevant Configuration

waste_collection_schedule:
  sources:
    - name: ics
      calendar_title: Rösrath (Hahnenberg)
      args:
        url: https://www.stadtwerke-roesrath.de/wp-admin/admin-ajax.php?action=swr_download_ics&street=hahnenberg&bins%5B%5D=&bins%5B%5D=26089&bins%5B%5D=26088&bins%5B%5D=26087&bins%5B%5D=26086&date=Tue+Jan+28+2025+13%3A57%3A21+GMT%2B0100+%28Mitteleurop%C3%A4ische+Normalzeit%29

Checklist Source Error

  • Use the example parameters for your source (often available in the documentation) (don't forget to restart Home Assistant after changing the configuration)
  • Checked that the website of your service provider is still working
  • Tested my attributes on the service provider website (if possible)
  • I have tested with the latest version of the integration (master) (for HACS in the 3 dot menu of the integration click on "Redownload" and choose master as version)

Checklist Sensor Error

  • Checked in the Home Assistant Calendar tab if the event names match the types names (if types argument is used)

Required

  • I have searched past (closed AND opened) issues to see if this bug has already been reported, and it hasn't been.
  • I understand that people give their precious time for free, and thus I've done my very best to make this problem as easy as possible to investigate.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant