Giter Site home page Giter Site logo

Comments (5)

galdor avatar galdor commented on May 18, 2024 1

I should have a patch for you tomorrow.

from gofeed.

galdor avatar galdor commented on May 18, 2024

For you information, numerical character references are decoded by encoding/xml starting at line 991 of https://golang.org/src/encoding/xml/xml.go.

from gofeed.

mmcdole avatar mmcdole commented on May 18, 2024

@galdor thanks for the bug report.

For a number of reasons I was unable to utilize go's built in xml chardata decoding. Mostly because I wanted to be able to parse naked XML/HTML for certain elements. This has me using the ,innerxml attribute which bypasses the built-in code you referenced.

So, I think to do this correctly, I'm going to have to re-implement what they do myself. I'll have to replace the string.Replace code that I use in parseutils.go with a proper parser which decodes both the numeric and non-numeric character entities it finds in the text.

I'm currently in the process of rewriting my unit tests for this project (due to an unintentional licensing violation on my part). When #53 is ready to merge with my completed Atom tests, I'll add some new unit tests for both atom/rss that ensures that character entities and numeric character entities get decoded correctly.

from gofeed.

galdor avatar galdor commented on May 18, 2024

So there's only DecodeEntities to modify, i.e. parse the string to decode both types of entities ? I could give it a try if you wish.

from gofeed.

mmcdole avatar mmcdole commented on May 18, 2024

@galdor sure, give it a try.

I had considered implementing it like I did the other entity decoding, but I was concerned if there was a lot of the numeric entities that we would have to match, it may be an expensive operation to strings.Replace for so many items.

But, perhaps doing it the slow way is better than nothing for now, and I can take time to implement it on a character-by-charcter basis (like go's xml package does) later when I have time.

from gofeed.

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.