Subject: | author field not properly encoded |
Run the synopsis and name the feed author "John Doe & \x{263a}". Because
this is passed through unchanged, the resulting feed is invalid XML.
Tests for this attached.
Subject: | 0001-tests-for-element-content-encoding.patch |
From 70c72b513f270c2f317b991e0658720cc5224b9d Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Lars=20D=C9=AA=E1=B4=87=E1=B4=84=E1=B4=8B=E1=B4=8F=E1=B4=A1=20=E8=BF=AA=E6=8B=89=E6=96=AF?= <daxim@cpan.org>
Date: Tue, 23 Jun 2009 17:52:57 +0200
Subject: [PATCH] tests for element content encoding
---
t/01.xml_writer.t | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/t/01.xml_writer.t b/t/01.xml_writer.t
index 181472f..705eee1 100644
--- a/t/01.xml_writer.t
+++ b/t/01.xml_writer.t
@@ -4,7 +4,7 @@ use strict;
use XML::Atom::SimpleFeed;
package XML::Atom::SimpleFeed;
-use Test::More tests => 7;
+use Test::More tests => 9;
is xml_escape( $_ = qq(<\x{FF34}\x{FF25}\x{FF33}\x{FF34} "&' d\xE3t\xE3>) ),
qq(<TEST "&' dãtã>),
@@ -20,5 +20,7 @@ is xml_string( $_ = qq(Test <![CDATA[<CDATA>]]> sections) ),
is xml_tag( 'br' ), '<br/>', 'simple tags are self-closed';
is xml_tag( 'b', 'foo', '<br/>' ), '<b>foo<br/></b>', 'tags with content are properly formed';
+is xml_tag( 'b', 'foo &' ), '<b>foo &</b>', 'XML special characters in element content are encoded';
+is xml_tag( 'b', 'foo âº' ), '<b>foo ☺</b>', 'non-ASCII in element content is encoded';
is xml_tag( [ 'br', clear => 'left' ] ), '<br clear="left"/>', 'simple tags can have attributes';
is xml_tag( [ 'b', style => 'color: red' ], 'foo', '<br/>' ), '<b style="color: red">foo<br/></b>', 'simple tags can have attributes';
--
1.6.3