Ignore:
Timestamp:
2004-07-22T12:13:45+12:00 (20 years ago)
Author:
jrm21
Message:

added a function, unicode::ensure_utf8(), that will test that the given
string ref is encoded with utf-8, and will modify it if necessary.

add_utf8_metadata() makes use of this function. (Eg previously source filenames
could cause problems).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/perllib/doc.pm

    r7569 r7798  
    788788}
    789789
    790 # add_utf8_metadata assumes the text has already been converted
    791 # to the UTF-8 encoding.
    792790sub add_utf8_metadata {
    793791    my $self = shift (@_);
     
    809807    }
    810808   
     809    # double check that the value is utf-8
     810    if (unicode::ensure_utf8(\$value)) {
     811    print STDERR "doc::add_utf8_metadata: warning: '$field' wasn't utf8\n";
     812    }
     813
    811814    push (@{$section_ptr->{'metadata'}}, [$field, $value]);
    812815}
Note: See TracChangeset for help on using the changeset viewer.