The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

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

SYNOPSIS

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

DESCRIPTION

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 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

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

Jcode

REPOSITORY

https://github.com/neilb/HTML-Summary

AUTHOR

Originally written by Ave Wrigley (AWRIGLEY), now maintained by Neil Bowers (NEILB).

COPYRIGHT

Copyright (c) 1997 Canon Research Centre Europe (CRE). All rights reserved.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.