Giter Site home page Giter Site logo

Comments (7)

GentlemanHal avatar GentlemanHal commented on August 26, 2024

Probably worth checking if there are any other 'dodgy' but not illegal characters that should also be escaped?

from scala-uri.

theon avatar theon commented on August 26, 2024

Agreed. I've added curly braces in be638f2 and some other characters such as new lines in a8a64d3 . This change should be available in the 0.3-SNAPSHOT.

I agree it makes sense to try and play nice with java.net.URI, so I'll leave this ticket open, until I have time to look through that code to work out exactly all the characters need to be encoded.

from scala-uri.

GentlemanHal avatar GentlemanHal commented on August 26, 2024

Ah cool, thanks for looking into this.

As mentioned before we don't really want to depend on a snapshot, so if you let me know when you push a new release that would be awesome.

from scala-uri.

theon avatar theon commented on August 26, 2024

Hi,

I've pushed version 0.3 out, so you can use that now. It should have the fix for {``} characters.

I still haven't got round to investigating all the characters that need to be encoded to play well with java.net.URI, so I will leave this ticket open for now.

from scala-uri.

theon avatar theon commented on August 26, 2024

I got lost in the character class masks in java.net.URI trying to find exactly which characters must be encoded to play nice with java.net.URI, so instead thought it would be easier to bute force it with this code. scala-uri encodes anything not in the ASCII range, so I only checked ASCII chars:

var ok = List[Char]()
var notOk = List[Char]()

(0 until 128).foreach(i => {
  try {
    URI.create(i.toChar.toString)
    ok = i.toChar :: ok
  } catch {
    case e:Exception => {
      notOk = i.toChar :: notOk
    }
  }
})

println("OK:" + ok.mkString)
println("NOT OK:" + notOk.mkString)

Results are:

OK:~zyxwvutsrqponmlkjihgfedcba_ZYXWVUTSRQPONMLKJIHGFEDCBA@?=;9876543210/.-,+*)('&$#!
NOT OK:}|{`^]\[><:%"

\ was the only NOT OK character that scala-uri wasn't encoding, so added here: 01c00bb

from scala-uri.

GentlemanHal avatar GentlemanHal commented on August 26, 2024

Awesome, thanks for fixing this.

Usual question, can you let me know when this is added to an official release? :)

from scala-uri.

theon avatar theon commented on August 26, 2024

Sorry for the delay. I've now published a 0.3.3 release which includes this.

from scala-uri.

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.