Changeset 1232


Ignore:
Timestamp:
Oct 19, 2008, 1:58:16 PM (13 years ago)
Author:
Dominic Hargreaves
Message:

Fix RDF encoding (fixes #260); thanks Inigo

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Changes

    r1231 r1232  
    1111        Correctly validate web site URLs during edit and display,
    1212        and truncate URLs that are too long (#21)
     13        Set content charset correctly in RDF (#260)
    1314
    14150.63    16 August 2008
  • trunk/lib/OpenGuides/RDF.pm

    r1207 r1232  
    7575                    site_desc  => $self->{site_description},
    7676                    og_version => $self->{og_version},
     77                    config     => $config,
    7778                  );
    7879
  • trunk/t/21_rdf.t

    r1231 r1232  
    1616}
    1717
    18 plan tests => 29;
     18plan tests => 30;
    1919
    2020Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
     
    8181my $rdfxml = $rdf_writer->emit_rdfxml( node => "Calthorpe Arms" );
    8282
    83 like( $rdfxml, qr|<\?xml version="1.0"\?>|, "RDF is encoding-neutral" );
     83like( $rdfxml, qr|<\?xml version="1.0" \?>|, "RDF uses no encoding when none set" );
     84$config->http_charset( "UTF-8" );
     85$guide = OpenGuides->new( config => $config );
     86$rdfxml = $rdf_writer->emit_rdfxml( node => "Calthorpe Arms" );
     87like( $rdfxml, qr|<\?xml version="1.0" encoding="UTF-8"\?>|, "RDF uses declared encoding" );
    8488
    8589like( $rdfxml, qr|<foaf:depiction rdf:resource="http://example.com/calthorpe.jpg" />|, "Node image");
  • trunk/templates/node_rdf.tt

    r1168 r1232  
    1 <?xml version="1.0"?>
     1<?xml version="1.0" [%- IF config.http_charset %]encoding="[% config.http_charset %]"[%- END %]?>
    22<rdf:RDF
    33  xmlns:dc      = "http://purl.org/dc/elements/1.1/"
  • trunk/templates/rdf_index.tt

    r1051 r1232  
    11[%- USE CGI -%]
    2 <?xml version="1.0"?>
     2<?xml version="1.0" [%- IF config.http_charset %]encoding="[% config.http_charset %]"[%- END %]?>
    33<rdf:RDF
    44  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
Note: See TracChangeset for help on using the changeset viewer.