[ 
https://issues.apache.org/jira/browse/MDEP-562?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15971143#comment-15971143
 ] 

Michael Osipov edited comment on MDEP-562 at 4/29/17 9:24 PM:
--------------------------------------------------------------

What could be done is to remove the default value and calculate the value if 
none was passed based on locale and OS. I have checked the C source code of  
[{{tree(1)}}|http://mama.indstate.edu/users/ice/tree/]:

{code}
struct linedraw {
  const char **name, *vert, *vert_left, *corner, *copy;
};

  static const struct linedraw cstable[]={
    { latin1_3,    "|  ",              "|--",            "·--",     
"©"   },
    { iso8859_789, "|  ",              "|--",            "·--",     
"(c)"      },
    { shift_jis,   "\204\240 ",        "\204\245",       "\204\244",       
"(c)"      },
    { euc_jp,      "\250\242 ",        "\250\247",       "\250\246",       
"(c)"      },
    { euc_kr,      "\246\242 ",        "\246\247",       "\246\246",       
"(c)"      },
    { iso2022jp,   "\033$B(\"\033(B ", "\033$B('\033(B", "\033$B(&\033(B", 
"(c)"      },
    { ibm_pc,      "\263  ",           "\303\304\304",   "\300\304\304",   
"(c)"      },
    { ibm_ps2,     "\263  ",           "\303\304\304",   "\300\304\304",   
"\227"     },
    { ibm_gr,      "\263  ",           "\303\304\304",   "\300\304\304",   
"\270"     },
    { gb,          "\251\246 ",        "\251\300",       "\251\270",       
"(c)"      },
    { utf8,        "\342\224\202\302\240\302\240",
    "\342\224\234\342\224\200\342\224\200", 
"\342\224\224\342\224\200\342\224\200", "\302\251" },
    { big5,        "\242x ",           "\242u",          "\242|",          
"(c)"      },
    { viscii,      "|  ",              "|--",            "`--",            
"\371"     },
    { koi8ru,      "\201  ",           "\206\200\200",   "\204\200\200",   
"\277"     },
    { windows,     "|  ",              "|--",            "`--",            
"\251"     },
    { NULL,        "|  ",              "|--",            "`--",            
"(c)"      }
  };
{code}

Here we have raw bytes. [~keirlawson], can you check the bytes with the 
codepoints you have provided? If all is well, we can try to remove the default 
param and check like the command does:

{code}
  setlocale(LC_CTYPE, "");
  setlocale(LC_COLLATE, "");

  charset = getcharset();
  if (charset == NULL && strcmp(nl_langinfo(CODESET), "UTF-8") == 0) {
    charset = "UTF-8";
  }
{code}

If this will works on {{sh}}, {{csh}}, {{bash}} with (non) UTF-8 locale on 
Linux, BSD and Windows 7, 10. We can have the improvement here.

[~hboutemy], any objections?


was (Author: michael-o):
What could be done is to remove the default value and calculate the value if 
none was passed based on locale and OS. I have checked the C source code of  
|{{tree(1)}}|http://mama.indstate.edu/users/ice/tree/]:

{code}
struct linedraw {
  const char **name, *vert, *vert_left, *corner, *copy;
};

  static const struct linedraw cstable[]={
    { latin1_3,    "|  ",              "|--",            "·--",     
"©"   },
    { iso8859_789, "|  ",              "|--",            "·--",     
"(c)"      },
    { shift_jis,   "\204\240 ",        "\204\245",       "\204\244",       
"(c)"      },
    { euc_jp,      "\250\242 ",        "\250\247",       "\250\246",       
"(c)"      },
    { euc_kr,      "\246\242 ",        "\246\247",       "\246\246",       
"(c)"      },
    { iso2022jp,   "\033$B(\"\033(B ", "\033$B('\033(B", "\033$B(&\033(B", 
"(c)"      },
    { ibm_pc,      "\263  ",           "\303\304\304",   "\300\304\304",   
"(c)"      },
    { ibm_ps2,     "\263  ",           "\303\304\304",   "\300\304\304",   
"\227"     },
    { ibm_gr,      "\263  ",           "\303\304\304",   "\300\304\304",   
"\270"     },
    { gb,          "\251\246 ",        "\251\300",       "\251\270",       
"(c)"      },
    { utf8,        "\342\224\202\302\240\302\240",
    "\342\224\234\342\224\200\342\224\200", 
"\342\224\224\342\224\200\342\224\200", "\302\251" },
    { big5,        "\242x ",           "\242u",          "\242|",          
"(c)"      },
    { viscii,      "|  ",              "|--",            "`--",            
"\371"     },
    { koi8ru,      "\201  ",           "\206\200\200",   "\204\200\200",   
"\277"     },
    { windows,     "|  ",              "|--",            "`--",            
"\251"     },
    { NULL,        "|  ",              "|--",            "`--",            
"(c)"      }
  };
{code}

Here we have raw bytes. [~keirlawson], can you check the bytes with the 
codepoints you have provided? If all is well, we can try to remove the default 
param and check like the command does:

{code}
  setlocale(LC_CTYPE, "");
  setlocale(LC_COLLATE, "");

  charset = getcharset();
  if (charset == NULL && strcmp(nl_langinfo(CODESET), "UTF-8") == 0) {
    charset = "UTF-8";
  }
{code}

If this will works on {{sh}}, {{csh}}, {{bash}} with (non) UTF-8 locale on 
Linux, BSD and Windows 7, 10. We can have the improvement here.

[~hboutemy], any objections?

> Make extended tokens default for displaying trees
> -------------------------------------------------
>
>                 Key: MDEP-562
>                 URL: https://issues.apache.org/jira/browse/MDEP-562
>             Project: Maven Dependency Plugin
>          Issue Type: Wish
>          Components: tree
>    Affects Versions: 3.0.0
>            Reporter: Keir
>
> Now that MSHARED-615 has been merged I would like to propose that this be 
> made the default behavior.  By this point most developers have 
> unicode-compatible terminals and given the extended characters make the tree 
> more readable it would be nice to have this as the default option.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to