[jruby-user] fast_xs inconsistent with MRI implementation

2 views
Skip to first unread message

Serguei Filimonov

unread,
Oct 7, 2009, 7:26:42 PM10/7/09
to user
In MRI ruby 1.8.6, we're seeing this behaviour of the fast_xs method:

>> require 'fast_xs'
=> true
>> " ' ".fast_xs
=> " ' "
>> "\"".fast_xs
=> """

But in JRuby 1.4RC1, the escaping is different.

jruby-1.4.0RC1 > require 'fast_xs'
 => true
jruby-1.4.0RC1 > " ' ".fast_xs
 => " ' "
jruby-1.4.0RC1 > "\"".fast_xs
 => """


We would like to achieve the MRI behavior in order to be consistent
with other parts of the code. Where can we modifiy the existing
fast_xs implementation? Or what can we use as an alternative?

Serguei

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email


Damian Steer

unread,
Oct 8, 2009, 6:28:15 AM10/8/09
to us...@jruby.codehaus.org

On 8 Oct 2009, at 00:26, Serguei Filimonov wrote:

> We would like to achieve the MRI behavior in order to be consistent
> with other parts of the code. Where can we modifiy the existing
> fast_xs implementation? Or what can we use as an alternative?

Are you using the same version of hpricot in both cases?

Damian

Thomas E Enebo

unread,
Oct 8, 2009, 4:16:12 PM10/8/09
to us...@jruby.codehaus.org
I just installed the same version of hpricot that JRuby works with and
I can confirm we are doing something different. I will spend a little
time to try and determine whether this is something in JRuby-proper or
whether this is a bug in the Java native extension of hpricot.

-Tom

--
blog: http://blog.enebo.com twitter: tom_enebo
mail: tom....@gmail.com

Thomas E Enebo

unread,
Oct 8, 2009, 4:43:39 PM10/8/09
to us...@jruby.codehaus.org
Ok this is from the fast_xs shipped as part of hpricot:
private static final String[][] APOS_ARRAY = {{"apos", "39"}, //
XML apostrophe
};

Removing this and a line from a static initializer fixes this, but I
am wondering whether perhaps someone needs to review all of the other
things getting escaped here...When I compare the C extension code to
the Java stuff, the Java stuff has many many more explicit
conversions. I certainly think we are in a position to quickly spin
a new version of hpricot, but someone with more knowledge of what
hpricot should be doing needs to resolve the differences between these
two lists of escaping.

-Tom

Reply all
Reply to author
Forward
0 new messages