sunaku / wmiirc

Ruby configuration for WMII window manager
ISC License
82 stars 26 forks source link

Personal #25

Closed adityam closed 13 years ago

adityam commented 13 years ago

I suddenly started getting invalid byte sequence in UTF-8 error from the power.yaml applet. (I don't remember updating my ruby installation, so I don't know what changed). After a bit of trial and error, the attached patch gets rid of the error. I am not sure if this is needed for others.

sunaku commented 13 years ago

Interesting, what does File.read(BAT_INFO_FILE).encoding evaluate to on you system?

adityam commented 13 years ago
irb(main):001:0> File.read('/proc/acpi/battery/BAT0/info').encoding
=> #<Encoding:UTF-8>
adityam commented 13 years ago

I wanted to just send a pull request for 04cda84, but it appears that github has included my entire tree in the request. Sorry about that.

sunaku commented 13 years ago

Interesting, I get the same encoding in IRB here:

>> File.read('/proc/acpi/battery/BAT0/info').encoding
#<Encoding:UTF-8>

But there's no encoding error when matching it against the rexgep as you experienced. Could you post the content of reading your battery status file? Mine is:

>> File.read('/proc/acpi/battery/BAT0/info')
"present:                 yes\ndesign capacity:         84000 mWh\nlast full capacity:      73305 mWh\nbattery technology:      rechargeable\ndesign voltage:          15000 mV\ndesign capacity warning: 8400 mWh\ndesign capacity low:     840 mWh\ncycle count:\t\t  0\ncapacity granularity 1:  840 mWh\ncapacity granularity 2:  840 mWh\nmodel number:            UL50-56\nserial number:            \nbattery type:            LIon\nOEM info:                ASUSTEK\n"
adityam commented 13 years ago

I get the same result.

 File.read('/proc/acpi/battery/BAT0/info')
=> "present:                 yes\ndesign capacity:         4400 mAh\nlast full capacity:      3785 mAh\nbattery technology:      rechargeable\ndesign voltage:          10800 mV\ndesign capacity warning: 220 mAh\ndesign capacity low:     132 mAh\ncycle count:\t\t  0\ncapacity granularity 1:  264 mAh\ncapacity granularity 2:  3780 mAh\nmodel number:            UM09H31\nserial number:           \nbattery type:            Lion\nOEM info:                SANYO \n"

If I run the regex match code explicitly in irb, I do not get error messages. I'll try to find a way to reproduce the error.

sunaku commented 13 years ago

Any update on this? I still don't get the error. And by the way, I changed the battery applet to use acpi instead of reading those Linux paths.

adityam commented 13 years ago

I have not yet updated to your latest version and am still using the patched version power.acpi. I think that the error arises due to some weird combination of settings on my machine. Since no one else seems to have this error, I'll close the issue.