Closed MTRNord closed 6 years ago
Hello @MTRNord,
thanks for reporting this problem.
What does
ruby -r et-orbi -e "EtOrbi._make_info"
yield on your system?
@jmettraux
Looks like the same error.
C:\Users\marce\RubymineProjects\knotenmailer>C:\Ruby24-x64\bin\ruby -r et-orbi -e "EtOrbi._make_info"
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/et-orbi-1.1.4/lib/et-orbi/zone_aliases.rb:6:in `sub': invalid byte sequence in UTF-8 (ArgumentError)
from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/et-orbi-1.1.4/lib/et-orbi/zone_aliases.rb:6:in `unalias'
from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/et-orbi-1.1.4/lib/et-orbi.rb:156:in `get_tzone'
from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/et-orbi-1.1.4/lib/et-orbi.rb:699:in `determine_local_tzone'
from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/et-orbi-1.1.4/lib/et-orbi.rb:170:in `render_nozone_time'
from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/et-orbi-1.1.4/lib/et-orbi.rb:209:in `_make_info'
from -e:1:in `<main>'
Hello @MTRNord,
thanks a lot. I'll have a closer look when I'm back home tomorrow.
Best regards.
Hello,
what does this program yield on your system?
require 'et-orbi'
module EtOrbi
def self.unalias(name)
p [ name, name.encoding ]
ZONE_ALIASES[name.sub(/ Daylight /, ' Standard ')] ||
unzz(name) ||
name
end
end
puts
puts '0 ---'
p EtOrbi::EoTime.now
puts
puts '1 ---'
EtOrbi._make_info
puts
It returns this:
C:\Ruby24-x64\bin\ruby.exe C:/Users/marce/RubymineProjects/node_alert/test.rb
0 ---
["Mitteleurop\xE4ische Sommerzeit", #<Encoding:UTF-8>]
C:/Users/marce/RubymineProjects/node_alert/test.rb:9:in `sub': invalid byte sequence in UTF-8 (ArgumentError)
from C:/Users/marce/RubymineProjects/node_alert/test.rb:9:in `unalias'
from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/et-orbi-1.1.4/lib/et-orbi.rb:156:in `get_tzone'
from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/et-orbi-1.1.4/lib/et-orbi.rb:699:in `determine_local_tzone'
from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/et-orbi-1.1.4/lib/et-orbi.rb:148:in `get_tzone'
from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/et-orbi-1.1.4/lib/et-orbi.rb:269:in `get_tzone'
from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/et-orbi-1.1.4/lib/et-orbi.rb:307:in `initialize'
from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/et-orbi-1.1.4/lib/et-orbi.rb:21:in `new'
from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/et-orbi-1.1.4/lib/et-orbi.rb:21:in `now'
from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/et-orbi-1.1.4/lib/et-orbi.rb:259:in `now'
from C:/Users/marce/RubymineProjects/node_alert/test.rb:18:in `<main>'
Process finished with exit code 1
Oh I guess it is because it gets returned in german and german has a ä
character in the text
Thank you very much! I will fix that now.
PS: not sure if you need the info but the returned string seems to be returned in iso-8859-1
and wrongly interpreted as UTF-8.
Using following converting fixes this error already (but after that it is unable to detect the timezone)
name = name.force_encoding('iso-8859-1')
name = name.encode('utf-8')
Using following converting fixes this error already (but after that it is unable to detect the timezone)
Thanks. Yes, Windows is difficult to support :-(
Yeah windows is always "fun" (fun as in->more work) :/ but thanks anyway for taking the time
Hello again,
is the commit above helping with the issue?
If auto-detection fails, you can insert
ENV['TZ'] = 'Europe/Berlin'
on top of your Ruby script to force it somehow.
If it still doesn't work, please give me the (newer) output of ruby -r et-orbi -e "EtOrbi._make_info"
@jmettraux yes that works :) only autodetection obviously does not but I guess translating everything to make it work would be more work than adding a real benefit
Thanks a lot, I will refine this fix and release 1.1.5 soon.
et-orbi 1.1.5 released: https://rubygems.org/gems/et-orbi
Thanks again.
Related to https://github.com/jmettraux/rufus-scheduler/issues/277
I use rufus-scheduler and I am not sure where to report it but most of the stacktrace mentions this lib:
I am using windows 10. tzinfo is loaded inside the Gemfile.
Simplified code I used to cause this is: