in reply to Re^2: Text::Wrap and non-Roman languages
in thread Text::Wrap and non-Roman languages

For me it works with use utf8 but issues the warnings:

substr outside of string at /usr/share/perl5/Text/WrapI18N.pm line 130 +. Use of uninitialized value $text in length at /usr/share/perl5/Text/Wr +apI18N.pm line 52.

Update: after investigating a bit more I also found Text::LineFold, it looks like it does the right thing, though it also ignores utf8 flag on strings.

use strict; use warnings; use 5.010; use utf8; use open ':std', ':utf8'; use Text::LineFold; my $lf = Text::LineFold->new( ColumnsMax => 12, ); while (<>) { my $folded = $lf->fold($_); utf8::decode($folded); say $folded; }