Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RDF::NTriples::Writer#format_uri should escape value #40

Closed
gkellogg opened this issue Aug 4, 2010 · 2 comments
Closed

RDF::NTriples::Writer#format_uri should escape value #40

gkellogg opened this issue Aug 4, 2010 · 2 comments
Labels

Comments

@gkellogg
Copy link
Member

gkellogg commented Aug 4, 2010

Just as literals must be escaped to be represented as valid RDF strings, URIs must also be escaped.

Consider making the following change:

def format_uri(uri, options = {})
  "<%s>" % escaped(uri_for(uri))
end

Here are specs I've used:

describe "utf-8 escaped" do
  {
    %(http://a/D%C3%BCrst)                => %(<http://a/D%C3%BCrst>),
    %(http://a/D\u00FCrst)                => %(<http://a/D\\u00FCrst>),
    %(http://b/Dürst)                     => %(<http://b/D\\u00FCrst>),
    %(http://a/\u{15678}another)          => %(<http://a/\\U00015678another>),
  }.each_pair do |uri, dump|
    it "should dump #{uri} as #{dump}" do
      RDF::URI.new(uri).to_ntriples.should == dump
    end
  end
end
@artob
Copy link
Member

artob commented Aug 4, 2010

Thanks, Gregg. I'll incorporate this into 0.2.3, which I'll probably cut tomorrow.

@artob
Copy link
Member

artob commented Nov 15, 2010

Fixed in 542d20c back in October. RDF.rb 0.3.0 will include this fix.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants