I’m looking at two developer machines runinng the same code. The code makes a call to a web service, parses it with nokogiri (v1.5.5 on both machines), and displays the result in a view.
One machine, running Ubuntu 12.04 and jruby 1.7, displays the expected results.
The other, running Windows 7 and jruby 1.7, garbles the character encoding (resulting in a bunch of ??? instead of the expected output).
I’ve checked that both are using the same jruby release and the exact same application code, so I’m suspecting that this may have something to do with the underlying JVM implementation.
How should I go about tracing this problem? Would it be appropriate to call this a jruby bug?
If the codes are same on both the machines, then the chances are that your any of the bundled gem is not compatible on windows with that code. I also faced many of such problems previously that were related to gems on windows after moving the code from Ubuntu.
On Ubuntu the sudo install commands for gems installs the gems and there dependencies by their own without any effort of downloading anything else but on windows the gem installations which have dependencies needs manual installation for them to work.
Please check any of the compatibility issues for any gem on windows. Morever I suspect the jruby to be causing bug as I too used nokogiri in my application on windows without any problems previously.
Morever,
Nokogirihas some features for dealing with different encodings (probably through Iconv), but I’m a little out of practice with that.In
Nokogiri, Strings are always stored as UTF-8 internally. Methods that return text values will always return UTF-8 encoded strings. Methods that return XML (like to_xml, to_html and inner_html) will return a string encoded like the source document.If you want Nokogiri to handle the document encoding properly, your best bet is to explicitly set the encoding.
Also check On windows, does it exhibit the same behavior if you just parse a normal text or html document?
Like:
This may also help you – http://nokogiri.org/. There also check the heading Developing on JRuby.