I've been using a program called par (offsite link) for quite some years now. It's a paragraph reformatter that I use mainly to justify text. When changed my system configuration to use UTF-8 everywhere (keyboard input, terminal output and so), par broke. Last weekend I searched some Perl module to replace it's functionality and, from the several results of my CPAN search, I picked one of which its description souded well: Text::Autoformat, by TheDamian. I'm encountering some problems with it but first, I'll show you the data (I replaced some characters with non-ASCII ones).

Original data

15:06. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Fus +ce ligula. Curabitur blandit dui ut urna. Nullam vel eros. Mauris rhoncus + sem. Dóńéc luctus velit eget quam. Mauris pellentesque. Vivamus quam. Mauri +s ságittis vulputate mauris. Nulla consequat est aliquam urna fringilla lacinia. Nunc auctor sagittis tortor.

Actual output

$ perl -MText::Autoformat -e' undef $/; print autoformat +<>, { right => 78, justify => "full", all => 1, lists => 0, }' < lorem-ipsum2 15:06. Lorem ipsum dolor sit amet, consectetuer adipiscing elit +. Fusce ligula. Curabitur blandit dui ut urna. Nullam vel eros. Mauris rhonc +us sem. Dóńéc luctus velit eget quam. Mauris pellentesque. Vivamus quam. M +auris ságittis vulputate mauris. Nulla consequat est aliquam urna fr +ingilla lacinia. Nunc auctor sagittis tortor.

Desired output

15:06. Lorem ipsum dolor sit amet, consectetuer adipiscing elit +. Fusce ligula. Curabitur blandit dui ut urna. Nullam vel eros. Mauris rhon +cus sem. Dóńéc luctus velit eget quam. Mauris pellentesque. Vivamus quam. + Mauris ságittis vulputate mauris. Nulla consequat est aliquam urna f +ringilla lacinia. Nunc auctor sagittis tortor.

There are two issues here:

Is there anything I can do to sort these out? I suspect the first problem can only be solved by modifying the code but maybe the second is easier.

Update: Tagged the par link as offsite.

--
David Serrano


In reply to Text::Autoformat: usage and multibyte-encoded text by Hue-Bond

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.