Author: dom Date: 2008-10-19 13:58:16 +0100 (Sun, 19 Oct 2008) New Revision: 1232
Modified: trunk/Changes trunk/lib/OpenGuides/RDF.pm trunk/t/21_rdf.t trunk/templates/node_rdf.tt trunk/templates/rdf_index.tt Log: Fix RDF encoding (fixes #260); thanks Inigo
Modified: trunk/Changes =================================================================== --- trunk/Changes 2008-10-18 18:19:22 UTC (rev 1231) +++ trunk/Changes 2008-10-19 12:58:16 UTC (rev 1232) @@ -10,6 +10,7 @@ JSON support for node details and metatdata discovery Correctly validate web site URLs during edit and display, and truncate URLs that are too long (#21) + Set content charset correctly in RDF (#260)
0.63 16 August 2008 Major overhaul of RDF output.
Modified: trunk/lib/OpenGuides/RDF.pm =================================================================== --- trunk/lib/OpenGuides/RDF.pm 2008-10-18 18:19:22 UTC (rev 1231) +++ trunk/lib/OpenGuides/RDF.pm 2008-10-19 12:58:16 UTC (rev 1232) @@ -74,6 +74,7 @@ site_name => $self->{site_name}, site_desc => $self->{site_description}, og_version => $self->{og_version}, + config => $config, );
my %defaults = (
Modified: trunk/t/21_rdf.t =================================================================== --- trunk/t/21_rdf.t 2008-10-18 18:19:22 UTC (rev 1231) +++ trunk/t/21_rdf.t 2008-10-19 12:58:16 UTC (rev 1232) @@ -15,7 +15,7 @@ plan skip_all => "DBD::SQLite could not be used - no database to test with. ($error)"; }
-plan tests => 29; +plan tests => 30;
Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } ); my $config = OpenGuides::Test->make_basic_config; @@ -80,7 +80,11 @@
my $rdfxml = $rdf_writer->emit_rdfxml( node => "Calthorpe Arms" );
-like( $rdfxml, qr|<?xml version="1.0"?>|, "RDF is encoding-neutral" ); +like( $rdfxml, qr|<?xml version="1.0" ?>|, "RDF uses no encoding when none set" ); +$config->http_charset( "UTF-8" ); +$guide = OpenGuides->new( config => $config ); +$rdfxml = $rdf_writer->emit_rdfxml( node => "Calthorpe Arms" ); +like( $rdfxml, qr|<?xml version="1.0" encoding="UTF-8"?>|, "RDF uses declared encoding" );
like( $rdfxml, qr|<foaf:depiction rdf:resource="http://example.com/calthorpe.jpg" />|, "Node image");
Modified: trunk/templates/node_rdf.tt =================================================================== --- trunk/templates/node_rdf.tt 2008-10-18 18:19:22 UTC (rev 1231) +++ trunk/templates/node_rdf.tt 2008-10-19 12:58:16 UTC (rev 1232) @@ -1,4 +1,4 @@ -<?xml version="1.0"?> +<?xml version="1.0" [%- IF config.http_charset %]encoding="[% config.http_charset %]"[%- END %]?> <rdf:RDF xmlns:dc = "http://purl.org/dc/elements/1.1/" xmlns:dcterms = "http://purl.org/dc/terms/"
Modified: trunk/templates/rdf_index.tt =================================================================== --- trunk/templates/rdf_index.tt 2008-10-18 18:19:22 UTC (rev 1231) +++ trunk/templates/rdf_index.tt 2008-10-19 12:58:16 UTC (rev 1232) @@ -1,5 +1,5 @@ [%- USE CGI -%] -<?xml version="1.0"?> +<?xml version="1.0" [%- IF config.http_charset %]encoding="[% config.http_charset %]"[%- END %]?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
openguides-commits@lists.openguides.org