++ed by:

1 PAUSE user

Tony G. Rose


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


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


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.


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




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


Copyright (c) 1997 Canon Research Centre Europe (CRE). All rights reserved. This script and any associated documentation or files cannot be distributed outside of CRE without express prior permission from CRE.