Hello,
I''m using Hpricot in a Rails app. I''m trying to modify how it
parses
non-breaking space entities ( ) so that they are converted into
spaces when using Hpricot''s inner_text (instead of being converted to
the corresponding unicode code point). To do this, I am trying this...
Hpricot::XChar::PREDEFINED_U.merge!({" " => 32})
as suggested in
http://code.whytheluckystiff.net/hpricot/ticket/137#comment:4
I''ve put that line at the beginning of the controller where
I''m using
Hpricot, and the problem is that when I try to run that code I get the
error...
uninitialized constant Hpricot::XChar
Any idea about why this is happenning? I''m using Rails 2.1.0
Thanks in advance.
xavi
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
I don''t know what could be causing that error but my suggestion would be that, if you can''t fix it, just modify the resulting string with gsub. That''s the best I can come up with. On Sep 16, 8:43 pm, Xavi Caballe <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Hello, > > I''m using Hpricot in a Rails app. I''m trying to modify how it parses > non-breaking space entities ( ) so that they are converted into > spaces when using Hpricot''s inner_text (instead of being converted to > the corresponding unicode code point). To do this, I am trying this... > > Hpricot::XChar::PREDEFINED_U.merge!({" " => 32}) > > as suggested inhttp://code.whytheluckystiff.net/hpricot/ticket/137#comment:4 > > I''ve put that line at the beginning of the controller where I''m using > Hpricot, and the problem is that when I try to run that code I get the > error... > > uninitialized constant Hpricot::XChar > > Any idea about why this is happenning? I''m using Rails 2.1.0 > > Thanks in advance. > > xavi > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
XChar implementation seems to be replaced by "c" based implementation
Changing the above statement to
Hpricot::PREDEFINED_U.merge!({" "
=> 32}) seems to execute without errors. I didn''t had time to test
it
out...
On Sep 16, 2:09 pm, Abel
<abel.tam...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> I don''t know what could be causing that error but my suggestion
would
> be that, if you can''t fix it, just modify the resulting string
with
> gsub. That''s the best I can come up with.
>
> On Sep 16, 8:43 pm, Xavi Caballe
<rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
> wrote:
>
> > Hello,
>
> > I''m using Hpricot in a Rails app. I''m trying to
modify how it parses
> > non-breaking space entities ( ) so that they are converted
into
> > spaces when using Hpricot''s inner_text (instead of being
converted to
> > the corresponding unicode code point). To do this, I am trying this...
>
> > Hpricot::XChar::PREDEFINED_U.merge!({" " => 32})
>
> > as suggested
inhttp://code.whytheluckystiff.net/hpricot/ticket/137#comment:4
>
> > I''ve put that line at the beginning of the controller where
I''m using
> > Hpricot, and the problem is that when I try to run that code I get the
> > error...
>
> > uninitialized constant Hpricot::XChar
>
> > Any idea about why this is happenning? I''m using Rails 2.1.0
>
> > Thanks in advance.
>
> > xavi
> > --
> > Posted viahttp://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
arvind wrote:> XChar implementation seems to be replaced by "c" based implementation > > Changing the above statement to Hpricot::PREDEFINED_U.merge!({" " > => 32}) seems to execute without errors. I didn''t had time to test it > out...That worked! Thanks all for your help! xavi -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---