[librdf-rdfa-generator-perl] 14/64: utf8-encoding
Jonas Smedegaard
dr at jones.dk
Sat Dec 23 12:22:51 UTC 2017
This is an automated email from the git hooks/post-receive script.
js pushed a commit to annotated tag debian/0.106-1
in repository librdf-rdfa-generator-perl.
commit 8bdeca30f682e3a895fab2e8ac937c37f1c4baee
Author: Toby Inkster <mail at tobyinkster.co.uk>
Date: Thu May 27 20:56:40 2010 +0000
utf8-encoding
--HG--
branch : RDF-RDFa-Generator
extra : convert_revision : svn%3A3fe8e991-6959-4966-b76d-b07eca2b6e37/RDF-RDFa-Generator%40373
---
example1-out.html | 4 +---
example1.pl | 1 +
lib/RDF/RDFa/Generator/HTML/Head.pm | 3 ++-
lib/RDF/RDFa/Generator/HTML/Pretty.pm | 11 ++++++-----
4 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/example1-out.html b/example1-out.html
index c7fdb3d..9aeb169 100644
--- a/example1-out.html
+++ b/example1-out.html
@@ -3,11 +3,9 @@
<head profile="http://www.w3.org/1999/xhtml/vocab">
<title>RDFa Document</title>
<meta nane="generator" value="RDF::RDFa::Generator::HTML::Pretty"/>
-<link rel="stylesheet" type="text/css" href="example1.css"/>
</head>
<body>
<h1>RDFa Document</h1>
<p><small>Generated by RDF::RDFa::Generator::HTML::Pretty.</small></p>
-<div xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:xhv="http://www.w3.org/1999/xhtml/vocab#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><div about="[_:r724178C05AEB11DFB1F4D1FFE6B6D6BAr0]"><h3 class="blank">_:r724178C05AEB11DFB1F4D1FFE6B6D6BAr0</h3><span class="rdf-type" rel="rdf:type"><img about="http://xmlns.com/foaf/0.1/Person" alt="http://xmlns.com/foaf/0.1/Person" src="data:image/png;charset=binary;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABHNCSVQICAgIfAhki [...]
+<div xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:xhv="http://www.w3.org/1999/xhtml/vocab#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><div about="http://example.net/"><h3 class="resource">http://example.net/</h3><span class="rdf-type" rel="rdf:type"><img about="http://xmlns.com/foaf/0.1/Document" alt="http://xmlns.com/foaf/0.1/Document" src="data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAQAAAC1+jfqAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXH [...]
</html>
-[?1049h[1;24r(B[m[4l[?7h[?12l[?25h[?1h=[?1h=[?1h=[39;49m[39;49m(B[m[H[2J(B[0;7m GNU nano 2.0.9 File: example1.pl [3;1H(B[muse lib "lib";
[5duse RDF::TrineShortcuts;
[6duse RDF::RDFa::Generator;
[8dmy $graph = rdf_parse(<<TURTLE, type=>'turtle');
[10d\@prefix foaf: <http://xmlns.com/foaf/0.1/> .
[11d\@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
[13d<http://example.net/>[15;9Ha foaf:Document ;[16;9H<http://www.w3.org/1999/xhtml/vocab#next> <http://example.net/page2> ;[17;9H<http://www.w3.org/1999/xhtml/vocab#title> "About Joe"@en ;[18;9Hfoaf:primaryTopic [[19;17Ha foaf:Person ;[20;17Hfoaf:name "Joe Bloggs" ;[21;17Hfoaf:plan "To conquer the world!"\@en[22;32H(B[0;7m[ Read 26 lines ]
[23d^G(B[m Get Help (B[0;7m^O(B[m WriteOut (B[0;7m^R(B[m Read File (B[0;7m^Y(B[m Prev Page (B[0;7m^K(B[m Cut Text (B[0;7m^C(B[m Cur Pos
[24d(B[0;7m^X(B[m Exit[14G(B[0;7m^J(B[m Justify (B[0;7m^W(B[m Where Is (B[0;7m^V(B[m Next Page (B[0;7m^U(B[m UnCut Text(B[0;7m^T(B[m To Spell
[3d[22;16H(B[0;7m[ line 1/27 (3%), col 1/15 (6%), char 0/705 (0%) ]
[3d(B[m[24;1H[?1049l
[?1l>
\ No newline at end of file
diff --git a/example1.pl b/example1.pl
index 7a30c6e..0038b3d 100644
--- a/example1.pl
+++ b/example1.pl
@@ -18,6 +18,7 @@ my $graph = rdf_parse(<<TURTLE, type=>'turtle');
foaf:name "Joe Bloggs" ;
foaf:plan "To conquer the world!"\@en
] ;
+ foaf:utf8 "fæces" ;
foaf:segment "Hello <b xmlns='http://www.w3.org/1999/xhtml'>World</b>"^^rdf:XMLLiteral .
TURTLE
diff --git a/lib/RDF/RDFa/Generator/HTML/Head.pm b/lib/RDF/RDFa/Generator/HTML/Head.pm
index d7cd57d..072cdc5 100644
--- a/lib/RDF/RDFa/Generator/HTML/Head.pm
+++ b/lib/RDF/RDFa/Generator/HTML/Head.pm
@@ -3,6 +3,7 @@ package RDF::RDFa::Generator::HTML::Head;
use 5.008;
use base qw'RDF::RDFa::Generator';
use common::sense;
+use Encode qw'encode_utf8';
use XML::LibXML qw':all';
our $VERSION = '0.04';
@@ -219,7 +220,7 @@ sub _process_object
return $self;
}
- $node->setAttribute('content', $st->object->literal_value);
+ $node->setAttribute('content', encode_utf8($st->object->literal_value));
if (defined $st->object->literal_datatype)
{
diff --git a/lib/RDF/RDFa/Generator/HTML/Pretty.pm b/lib/RDF/RDFa/Generator/HTML/Pretty.pm
index bb7aa63..90d9687 100644
--- a/lib/RDF/RDFa/Generator/HTML/Pretty.pm
+++ b/lib/RDF/RDFa/Generator/HTML/Pretty.pm
@@ -4,6 +4,7 @@ use 5.008;
use base qw'RDF::RDFa::Generator::HTML::Hidden';
use common::sense;
use constant XHTML_NS => 'http://www.w3.org/1999/xhtml';
+use Encode qw'encode_utf8';
use Icon::FamFamFam::Silk;
use RDF::RDFa::Generator::HTML::Pretty::Note;
use XML::LibXML qw':all';
@@ -199,7 +200,7 @@ sub _resource_statements
$DD->setAttribute('property', $self->_make_curie($st->predicate->uri, $prefixes));
$DD->setAttribute('class', 'plain-literal');
$DD->setAttribute('xml:lang', $st->object->literal_value_language);
- $DD->appendTextNode($st->object->literal_value);
+ $DD->appendTextNode(encode_utf8($st->object->literal_value));
}
elsif ($self->{'safe_xml_literals'}
&& $st->object->is_literal
@@ -209,8 +210,8 @@ sub _resource_statements
$DD->setAttribute('property', $self->_make_curie($st->predicate->uri, $prefixes));
$DD->setAttribute('class', 'typed-literal datatype-xmlliteral');
$DD->setAttribute('datatype', $self->_make_curie($st->object->literal_datatype, $prefixes));
- $DD->setAttribute('content', $st->object->literal_value);
- $DD->addNewChild(XHTML_NS, 'pre')->addNewChild(XHTML_NS, 'code')->appendTextNode($st->object->literal_value);
+ $DD->setAttribute('content', encode_utf8($st->object->literal_value));
+ $DD->addNewChild(XHTML_NS, 'pre')->addNewChild(XHTML_NS, 'code')->appendTextNode(encode_utf8($st->object->literal_value));
}
elsif ($st->object->is_literal
&& $st->object->has_datatype
@@ -219,7 +220,7 @@ sub _resource_statements
$DD->setAttribute('property', $self->_make_curie($st->predicate->uri, $prefixes));
$DD->setAttribute('class', 'typed-literal datatype-xmlliteral');
$DD->setAttribute('datatype', $self->_make_curie($st->object->literal_datatype, $prefixes));
- $DD->appendWellBalancedChunk($st->object->literal_value);
+ $DD->appendWellBalancedChunk(encode_utf8($st->object->literal_value));
}
elsif ($st->object->is_literal
&& $st->object->has_datatype)
@@ -227,7 +228,7 @@ sub _resource_statements
$DD->setAttribute('property', $self->_make_curie($st->predicate->uri, $prefixes));
$DD->setAttribute('class', 'typed-literal');
$DD->setAttribute('datatype', $self->_make_curie($st->object->literal_datatype, $prefixes));
- $DD->appendTextNode($st->object->literal_value);
+ $DD->appendTextNode(encode_utf8($st->object->literal_value));
}
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/librdf-rdfa-generator-perl.git
More information about the Pkg-perl-cvs-commits
mailing list