Lingua::JA::Jtruncate - module to truncate Japanese encoded text.


HTML-Summary documentation  | view source Contained in the HTML-Summary distribution.

Index


NAME

Top

Lingua::JA::Jtruncate - module to truncate Japanese encoded text.

SYNOPSIS

Top

    use Lingua::JA::Jtruncate qw( jtruncate );
    $truncated_jtext = jtruncate( $jtext, $length );

DESCRIPTION

Top

The jtruncate function truncates text to a length $length less than bytes. It is designed to cope with Japanese text which has been encoded using one of the standard encoding schemes - EUC, JIS, and Shift-JIS. It uses the Lingua::JA::Jcode module to detect what encoding is being used. If the text is none of the above Japanese encodings, the text is just truncated using substr. If it is detected as Japanese text, it tries to truncate the text as well as possible without breaking the multi-byte encoding. It does this by detecting the character encoding of the text, and recursively deleting Japanese (possibly multi-byte) characters from the end of the text until it is underneath the length specified. It should work for EUC, JIS and Shift-JIS encodings.

FUNCTIONS

Top

jtruncate( $jtext, $length )

jtruncate takes some japanese text and a byte length as arguments, and returns the japanese text truncated to that byte length.

    $truncated_jtext = jtruncate( $jtext, $length );

SEE ALSO

Top

    Lingua::JA::Jcode

AUTHOR

Top

Ave Wrigley <wrigley@cre.canon.co.uk>

COPYRIGHT

Top


HTML-Summary documentation  | view source Contained in the HTML-Summary distribution.