ruby on rails - Nokogiri adds characters during parsing on Heroku -


it seems nokogiri has problem utf-8 conversion of nbsp character. i've gathered issue related libxml2. nokogiri recommends upgrading libxml2 2.7.7 instead of 2.7.6 that's running on heroku.

anyone know how can use libxml2 2.7.7 (or higher) on heroku?

the problem follows --

doc = nokogiri::html("<html><p>hi hello</p></html>") doc.inner_html => "<html><body><p>hi hello</p></body></html>"  doc.inner_html = "<p>hello&nbsp;world</p>" => "<p>hello&nbsp;world</p>"  doc.inner_html => "<p>helloƂ world</p>" 

looks related: https://github.com/sparklemotion/nokogiri/issues/306

this doesn't happen on local machine. rails has 'utf-8' set config.encoding , page that's rendered has utf-8 charset meta tag.

on local machine i'm running nokogiri 1.6 limxml2 2.8.0 , on heroku i'm running nokogiri 1.6 libxml2 2.7.6.

thanks.

unfortunately heroku doesn't support installing additional libraries or binaries stacks. best workaround vendor these project. you'll need use 64-bit linux versions make them work on heroku; compiling statically can ensure dependencies needed included. similarly, gems depend on external libraries, recommend compiling gem statically , vendoring project.

if wish try vendor binary, library, or gem, can use heroku build environment. 1 of herokus engineers created build server allows upload source code, run compilation step, , download resulting binary. can find project on github under name "vulcan".

heres link more instructions... https://devcenter.heroku.com/articles/buildpack-binaries


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -