Coder Social home page Coder Social logo

Comments (7)

threedaymonk avatar threedaymonk commented on July 17, 2024

I can't reproduce this using Ruby 1.8.7 (non-REE):

>> require 'htmlentities'
=> true
>> HTMLEntities::VERSION::STRING
=> "4.2.4"
>> coder = HTMLEntities.new
=> #<HTMLEntities:0x7f2aba3496d0 @flavor="xhtml1">
>> string = "&ldquo;These pretzels are making me thirsty&hellip;&rdquo;"
=> "&ldquo;These pretzels are making me thirsty&hellip;&rdquo;"
>> s = coder.decode(string)
=> "\342\200\234These pretzels are making me thirsty\342\200\246\342\200\235"
>> puts s
“These pretzels are making me thirsty…”
=> nil
>> $KCODE = 'u'
=> "u"
>> s
=> "“These pretzels are making me thirsty…”"

What do you get from the same commands?

from htmlentities.

johnlauck avatar johnlauck commented on July 17, 2024

Looks like an issue with ree 1.8.7?

ruby 1.8.7 (2010-08-16 patchlevel 302) [i686-darwin10.6.0]

>> require 'htmlentities'
=> true
>> HTMLEntities::VERSION::STRING
=> "4.2.4"
>> coder = HTMLEntities.new
=> #<HTMLEntities:0x100593840 @flavor="xhtml1">
>> string = "&ldquo;These pretzels are making me thirsty&hellip;&rdquo;"
=> "&ldquo;These pretzels are making me thirsty&hellip;&rdquo;"
>> s = coder.decode(string)
=> "\342\200\234These pretzels are making me thirsty\342\200\246\342\200\235"
>> puts s
“These pretzels are making me thirsty…”
=> nil
>>  $KCODE = 'u'
=> "u"
>> s
=> "“These pretzels are making me thirsty…”"

ruby 1.8.7 (2010-04-19 patchlevel 253) [i686-darwin10.4.0], MBARI 0x6770, Ruby Enterprise Edition 2010.02

>> require 'htmlentities'
=> true
>> HTMLEntities::VERSION::STRING
=> "4.2.4"
>> coder = HTMLEntities.new
=> #<HTMLEntities:0x1015a1d18 @flavor="xhtml1">
>> string = "&ldquo;These pretzels are making me thirsty&hellip;&rdquo;"
=> "&ldquo;These pretzels are making me thirsty&hellip;&rdquo;"
>> s = coder.decode(string)
=> "\342\200\234These pretzels are making me thirsty\342\200\246\342\200\235"
>> puts s
“These pretzels are making me thirsty…”
=> nil
>> $KCODE = 'u'
=> "u"
>> s
=> "“These pretzels are making me thirsty…\342\200\235"

from htmlentities.

threedaymonk avatar threedaymonk commented on July 17, 2024

It does seem like it's REE rather than HTMLEntities, and specifically either irb or the implementation of inspect. What do you get if you do this with REE:

>> $KCODE = 'u'
=> "u"
>> "\342\200\235"
=> "”"

If you get an escape sequence in the last line, then I'll assume that it's a problem with REE and close this issue, if that's OK.

from htmlentities.

johnlauck avatar johnlauck commented on July 17, 2024

ree output is "\342\200\235"

Thanks for your help. Any idea for a work around?

from htmlentities.

threedaymonk avatar threedaymonk commented on July 17, 2024

Sounds like a bug in REE then. Are you convinced it's really a problem? Do you get escape characters instead of the quote anywhere except in irb? Because if it's only in irb, then it's just an irritation but shouldn't actually affect anything at an operational level.

from htmlentities.

threedaymonk avatar threedaymonk commented on July 17, 2024

(Closing this as I'm confident it's not an HTMLEntities bug)

from htmlentities.

johnlauck avatar johnlauck commented on July 17, 2024

Update: I tested this on REE 1.8.7-head and it works. I think the REE 1.8.7-2011.01 includes the fix.

from htmlentities.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.