Skip to content

--wrap ignores FULLWIDTH (i.e., CJK!) #835

Open
@jidanni

Description

@jidanni

The awful truth about

       --wrap Integer (68 if unset)
              This option specifies the right margin Tidy uses for line wrapping.

              Tidy tries to wrap lines so that they do not exceed this length.

              Set wrap to 0 (zero) if you want to disable line wrapping.

is that it mindlessly assumes each character is one screen column, and
ignores e.g.,

$ unicode X
U+FF38 FULLWIDTH LATIN CAPITAL LETTER X

$ perl -wle '$m = join " ", ( "X" x 5 ) x 15;
$n = join " ", ( "Y" x 10 ) x 15;
print "<P>$_</P>" for $m, $n;
' | tidy
..."HTML Tidy for HTML5 for Linux version 5.6.0">...
<p>XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX
XXXXX XXXXX XXXXX XXXXX XXXXX</p>
<p>YYYYYYYYYY YYYYYYYYYY YYYYYYYYYY YYYYYYYYYY YYYYYYYYYY
YYYYYYYYYY YYYYYYYYYY YYYYYYYYYY YYYYYYYYYY YYYYYYYYYY YYYYYYYYYY
YYYYYYYYYY YYYYYYYYYY YYYYYYYYYY YYYYYYYYYY</p>

i.e., with no consideration of CJK users!

It's as if "those Asian people like using wider characters because in
Asia they probably all use wider monitors anyway."

See perl's Text::CharWidth - Get number of occupied columns of a string on terminal.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions