distatus / battery

cross-platform, normalized battery information library
MIT License
249 stars 36 forks source link

fix: remove unicode chars before parsing battery XML #15

Open JanDeDobbeleer opened 4 years ago

JanDeDobbeleer commented 4 years ago

We could argue this fix should be added to @DHowett 's go-plist utility, but I felt more comfortable adding the change here for the time being as I needed a working fork. This issue only seems to pop up when fully charged, with this change it can once again parse and provide battery information.

DHowett commented 4 years ago

I'd be interested in hearing that argument! 😄

KenjiTakahashi commented 4 years ago

Interesting indeed. Would you be able to provide example of the input that's breaking it? I've never seen this myself, but then again I'm using English as OS language which is "easy path".

JanDeDobbeleer commented 4 years ago

I'd be interested in hearing that argument! 😄

Well, it's failing in your utility because of that "illegal character". In my opinion, if the goal of a utility is to parse plist files on MacOS and it can't handle some of the platform files being thrown at it, we have to correct it there. I'm also using EN as the language on my laptop, although region info might change. Let me see if I can reproduce this and provide input for the discussion 😁

floam commented 1 year ago

What is the invalid codepoint/bytes, and where?

JanDeDobbeleer commented 1 year ago

@floam it's been 2 years and we've moved on to other means 😃