On 24.10.2014 15:06, Mark Phippard wrote:
> When we use the Subversion API via JavaHL it is up to the caller to
> provide repository URI in proper encoded format, such as %20 for
> spaces. I have never found the perfect Java method for doing this.
> In Subclipse, we are currently using this method:
>
> http://docs.oracle.com/javase/7/docs/api/java/net/URI.html#toASCIIString()
> <http://docs.oracle.com/javase/7/docs/api/java/net/URI.html#toASCIIString%28%29>
>
> It does a good job handling UTF8 characters, but as an example it does
> not convert spaces to %20 so we have do that ourselves. There are
> other characters like [, ], #, % it does not convert. So it is kind
> of a constant battle to workaround the differences.
>
> I have a couple questions:
>
> 1) Could JavaHL itself expose a Subversion library method that could
> do this for us? I assume Subversion must have some method that it
> uses to canonicalize a URL. Maybe this could just be exposed to
> JavaHL. Pass it a String and get back the canonical version?
>
> 2) Is the Subversion URI format governed by a specific RFC? Mainly
> asking that question for an alternative to #1. If we are searching
> for a better Java method to use and they mention an RFC it would help
> to find a better fit.
>
> I am not sure if I am using "canonical" correctly here. I assume you
> get the gist of what I am asking though.
Ideally, the JavaHL API (being "high-level") would not require
URL-encoding at the API level. But that's water below the bridge by now.
Adding encoding+decoding APIs would certainly help.
-- Brane
Received on 2014-10-24 16:05:03 CEST