Hello,

i'm struggling around with umlauts in my xml files, which i want to
parse with XML::Rabbit.
I've got the same behaviour with __DATA__ or when i'm reading a xml file
via MyNode->new(file => ....);

And i've got non idea what i am doing wrong :(
(ps: yes, the testcase is utf8 encoded acording to the file command)

 % perl xml_rabbit.t
#
# 195
not ok 1 - umlaut in xml
#   Failed test 'umlaut in xml'
#   at xml_rabbit.t line 18.
#          got: '�'
#     expected: 'ü'
not ok 2 - ord of umlaut
#   Failed test 'ord of umlaut'
#   at xml_rabbit.t line 19.
#          got: '195'
#     expected: '252'
1..2
# Looks like you failed 2 tests of 2.


 % cat xml_rabbit.t
#!/usr/bin/env perl

package MyNode;
use XML::Rabbit::Root;
has_xpath_value umlaut  => '/x/umlaut';

package main;
use Test::More;

my $xml = do{local $/; <DATA>};
my $node = MyNode->new(xml => $xml);

diag $node->umlaut;
diag ord "ü";
is($node->umlaut, "ü", "umlaut in xml");
is(ord("ü"), ord($node->umlaut), "ord of umlaut");

done_testing(2);

__DATA__
<?xml version="1.0" encoding="UTF-8"?>
<x>
    <umlaut>ü</umlaut>
</x>
 % perl -v

This is perl 5, version 20, subversion 1 (v5.20.1) built for x86_64-linux



-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to