franc6 / ics_calendar

Provides an ICS (icalendar) platform for the Home Assistant calendar
Apache License 2.0
128 stars 19 forks source link

Fix UnicodeEncodeError for emoji-containing URLs #133

Closed moritzb57 closed 4 weeks ago

moritzb57 commented 2 months ago

Resolved an issue where URLs containing emojis or other non-ASCII characters caused a UnicodeEncodeError when used with urlopen. The fix includes:

This update ensures the ics_calendar integration can handle URLs with special characters without encountering encoding issues.

franc6 commented 4 weeks ago

Thank you!

Sorry it's taken so long for me to get to this.

franc6 commented 4 weeks ago

Just FYI, I should have paid more attention, hanow() was correct; using datetime.now() doesn't use HA's idea of what "now" is, and mocking out datetime.now() isn't really feasible. hanow() can be easily mocked, so the unit tests can work with specific dates and times. I've pushed a fix already. :)