Giter VIP home page Giter VIP logo

Comments (7)

tordanik avatar tordanik commented on June 14, 2024

Thanks for the report, this is indeed a rather major problem. I've reported it upstream with the osm4j library (issue #11), I hope we can collaborate to resolve this.

I've also attached a small example to reproduce the problem to the upstream issue.

from osm2world.

sebkur avatar sebkur commented on June 14, 2024

Hey, I've added a test in osm4j as reported in the upstream issue and was not able to reproduce the problem.

I've taken a look at OSM2World's code and it looks like your completely rewriting the file in case it has detected that it has been created by JOSM here

protected static final File createTempFileWithJosmWorkarounds(InputStream josmDataInputStream) throws IOException {

Is it possible that something is going wrong with the charsets during that conversion?

Could you take a look at the temporary file created from the example file?

from osm2world.

sebkur avatar sebkur commented on June 14, 2024

Looks like that piece of code converts the emoji to this: user="account with emoji 😎"

from osm2world.

sebkur avatar sebkur commented on June 14, 2024

I can still read that modified file in my test though...

from osm2world.

tordanik avatar tordanik commented on June 14, 2024

That's interesting!

I'm indeed rewriting files which have been generated by JOSM because (I believe) osm4j does not have built-in support for the JOSM dialect of OSM XML with additional attributes such as action=delete.

For some reason, I did not initially have that on my radar as a possible cause – but I now believe that it's likely to be involved because OSM2World is able to read the problem files if I change the generator attribute (and therefore disable my JOSM-specific code).

I'll investigate further and report the results.

from osm2world.

sebkur avatar sebkur commented on June 14, 2024

I'll investigate further and report the results.

thanks!

I'm indeed rewriting files which have been generated by JOSM because (I believe) osm4j does not have built-in support for the JOSM dialect of OSM XML with additional attributes such as action=delete.

Maybe we could improve osm4j to at least parse the files from JOSM even if it cannot currently store the additional data in its data model. Will need to find a suitable test file... I've created topobyte/osm4j#12 to track this.

from osm2world.

tordanik avatar tordanik commented on June 14, 2024

I've created a fix in 2ae6340. It writes the transformed XML file to an UTF-16 Java String and relies on Apache Commons' IOUtils to output this as correctly encoded UTF-8. As of 26e9bbd, I've also used the opportunity to replace the temporary files with an in-memory representation.

I've added one unit test and did some manual testing as well. It appears to work fine now. Not the most elegant approach, but to achieve a nice long-term solution, I'd rather help improve osm4j. 🙂️

The next OSM2World build will contain the fix.

from osm2world.

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.