i18n::substr????

[email protected] (Mags Doheny) Thu, 05 Jun 2003 19:53:54 -0700
Newsgroups perl.i18n
Message-ID <[email protected]>
Hi,

Is there some way to extract a substring in any encoding, ensuring that
valid chars are always extracted?

setlocale(LC_CTYPE, "$locale");
$string = "some_multibyte_or_bidi_string";
$extracted_chars = substr($string, x, y);

is there some magic value for x & y which will work for all encodings?
(I don't care what the offset is once it's >0, nor how long the string
is once it's a valid string of chars contained in $string).

Even better, is there some i18n perl function which would do this
reliably?

thanks,
mags.