Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multibyte regex error #25

Closed
flavorjones opened this issue Oct 26, 2010 · 13 comments
Closed

multibyte regex error #25

flavorjones opened this issue Oct 26, 2010 · 13 comments

Comments

@flavorjones
Copy link
Owner

Reported on ruby-talk by Une Bévue unbewusst.sein@fai.invalid


because i'm using daily nokogiri i wanted to test loofah with a small
script (coming from http://loofah.rubyforge.org/loofah/) :

#! /opt/local/bin/ruby1.9
# encoding: utf-8

require 'rubygems'
require 'nokogiri'
require 'loofah'

unsafe_html="ohai! <div>div is safe</div> <script>but script is
not</script>"

doc=Loofah.fragment(unsafe_html).scrub!(:strip)
puts doc.to_s

however i got :

SyntaxError:
/opt/local/lib/ruby1.9/gems/1.9.1/gems/loofah-1.0.0/lib/loofah/html5/scr
ub.rb:20: too short escaped multibyte character:
/`|[\000-\040\177\s]+|\302[\200-\240]/
method require in untitled document at line 29
method require in untitled document at line 29
method <top (required)> in loofah.rb at line 9
method require in untitled document at line 33
method rescue in require in untitled document at line 33
method require in untitled document at line 29
method <main> in loofah_first_test.rb at line 22

ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin10]
over Mac OS X SL

@flavorjones
Copy link
Owner Author

I am unable to reproduce this issue on 1.9.2p0, current 1.9.2 trunk, 1.8.7p249 or any other of several (current) ruby versions.

I need more details on your system in order to diagnose this issue. What else can you tell me?

@unbewusst
Copy link

I'm using : loofah (1.0.0) with nokogiri (1.4.3.1) under Mac OS X SL 10.6.4 (latest)
libxml / libxsl have been installed thru MacPorts :
libxml2 @2.7.7_0 (active)
libxslt @1.1.26_0 (active)

also i got exactly the same error with the following :
puts Loofah.xml_document('org.ytho.launchctl.list.plist').is_a?(Nokogiri::XML::Document)

notice that 'org.ytho.launchctl.list.plist' is a valid xml.

i'll be happy to answer any question, thanks !

@ammar
Copy link

ammar commented Oct 26, 2010

I'm seeing this error consistently on a couple of machines with 1.9.2:

  ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-linux]
  ruby 1.9.2p0 (2010-08-18 revision 29036) [i386-darwin9.8.0]

However, the expression does not raise an error on init with:

  ruby 1.8.6 (2009-06-08 patchlevel 369) [universal-darwin9.0]
  ruby 1.8.7 (2010-08-16 patchlevel 302) [i686-darwin9.8.0]

Might be a 1.9.2p0 bug, but I'm not sure yet.

@atechie
Copy link

atechie commented May 3, 2011

I get the same error. More details
ruby 1.9.2 (p180)

and commad used to run ruby is

ruby -KU -E utf-8:utf-8 -rubygems

@flavorjones
Copy link
Owner Author

I have a fix for this issue. Will be released early next week. Sorry for the delay.

@flavorjones
Copy link
Owner Author

Fix is in 1.1.0, just released.

@sydneyitguy
Copy link

@flavorjones
This issue is appeared again on ruby 2.0 (I'm using ruby 2.0.0p195)

@flavorjones
Copy link
Owner Author

Please open a new issue. Thanks.

@tbbooher
Copy link

tbbooher commented Jun 1, 2013

is there a new issue on this one?

@svenfuchs
Copy link

seeing this issue on ruby 2.0, too

maybe it'd make sense to add a matrix to .travis.yml and test against various ruby versions? :)

@zhon
Copy link

zhon commented Jul 15, 2013

Having same problem on ruby 2.0. What is the new issue number?

@ghost
Copy link

ghost commented Jul 19, 2013

Hi, I also get same error, but in my case, it is probably not loofah's fault. Because it happens when I add 'gem feedzirra' and 'bundle install'.
https://rubygems.org/gems/feedzirra
Unfortunately the published version without specifying the version is old and doesn't have gemspec yet (while the master branch already has gemspec). So bundler installs loofah 1.0.0 for the gem, which had not supported ruby1.9, in my environment.

When I specify feedzirra 0.2.0.rc2 so that the error disappears.
I use ruby 2.0.0p247

@baxang
Copy link

baxang commented Sep 25, 2013

@ntaoo Thanks for the info. Removing feedzirra from my Gemfile eliminated the error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants