File: 18-unicode.t

package info (click to toggle)
libxml-atom-perl 0.37-1%2Bsqueeze1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 488 kB
  • ctags: 308
  • sloc: perl: 2,641; xml: 673; makefile: 2
file content (34 lines) | stat: -rw-r--r-- 897 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# $Id$

use strict;
use encoding "utf-8";

use Test::More skip_all => "Skipping Unicode test since it depends on LibXML";
use XML::Atom;
use XML::Atom::Entry;
use XML::Atom::Person;

$XML::Atom::ForceUnicode = 1;

my $entry;
$entry = XML::Atom::Entry->new('t/samples/entry-utf8.xml');

ok $entry;
ok utf8::is_utf8($entry->title);
ok utf8::is_utf8($entry->summary);
ok utf8::is_utf8($entry->author->name);

is $entry->title, "フーバー";
is $entry->summary, "これはサマリ";
is $entry->author->name, "ミナ";

my $dc = XML::Atom::Namespace->new(dc => 'http://purl.org/dc/elements/1.1/');
my @cat = $entry->getlist($dc, 'subject');
ok utf8::is_utf8($cat[0]);
ok utf8::is_utf8($cat[1]);
is $cat[0], "たべもの";
is $cat[1], "猫";

is $entry->content->type, 'text/html';
ok utf8::is_utf8($entry->content->body);
is $entry->content->body, "<p>これは日本語のポストです。</p>";