All pastes #821607 Raw Edit

寄せ集め

public text v1 · immutable
·published 2007-12-18 06:25 UTC
rendered paste body
44c44
<     $doc->add_attr('@title' => $args->{entry}->title->utf8);
---
>     $doc->add_attr('@title' => _test_utf8($args->{entry}->title));
46c46
<     $doc->add_attr('@author' => $args->{entry}->author->utf8) if $args->{entry}->author;
---
>     $doc->add_attr('@author' => _test_utf8($args->{entry}->author)) if $args->{entry}->author;
48,49c48,52
<     $doc->add_text($args->{entry}->body->utf8);
<     $doc->add_hidden_text($args->{entry}->title->utf8);
---
>     $doc->add_text(_test_utf8($args->{entry}->body));
>     $doc->add_hidden_text(_test_utf8($args->{entry}->title));
>     
>     my $tag_str = encode('utf-8', join ', ', @{$args->{entry}->tags});
>     $doc->add_hidden_text($tag_str);
52c55
< 
---
>     
90a94,104
> sub _test_utf8 {
>     my $str = shift;
>     my $result;
>     if (eval {$result = $str->utf8}) {
>         return $result;
>     }
>     else {
>         return $str;
>     }
> }
>