git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Need multibyte advice - Shift-JIS

From
Michal Suchánek <msuchanek@suse.de>
Date
Feb 27, 2019, 17:50 UTC
Message-ID
<20190227185044.120c0ba7@kitsune.suse.cz>
In-Reply-To
<001b01d4cec3$364149e0$a2c3dda0$@nexbridge.com>

On Wed, 27 Feb 2019 12:38:06 -0500 "Randall S. Becker" <rsbecker@nexbridge.com> wrote:

Show 105 quoted lines
> On February 27, 2019 12:15, Michal Suchánek wrote:
> > To: Randall S. Becker <rsbecker@nexbridge.com>
> > Cc: git@vger.kernel.org
> > Subject: Re: Need multibyte advice - Shift-JIS
> > 
> > On Wed, 27 Feb 2019 12:03:58 -0500
> > "Randall S. Becker" <rsbecker@nexbridge.com> wrote:
> >   
> > > On February 27, 2019 11:52, Michal Suchánek wrote:  
> > > > To: Randall S. Becker <rsbecker@nexbridge.com>
> > > > Cc: git@vger.kernel.org
> > > > Subject: Re: Need multibyte advice - Shift-JIS
> > > >
> > > > On Wed, 27 Feb 2019 11:33:47 -0500
> > > > "Randall S. Becker" <rsbecker@nexbridge.com> wrote:
> > > >  
> > > > > On February 27, 2019 11:29 Michal Suchánek wrote:  
> > > > > > On Wed, 27 Feb 2019 11:19:33 -0500 "Randall S. Becker"
> > > > > > <rsbecker@nexbridge.com> wrote:
> > > > > >  
> > > > > > > On February 27, 2019 11:11, Michal Suchánek wrote:  
> > > > > > > > On Wed, 27 Feb 2019 10:54:23 -0500 "Randall S. Becker"
> > > > > > > > <rsbecker@nexbridge.com> wrote:
> > > > > > > >  
> > > > > > > > > On February 27, 2019 9:09, Michal Suchánek wrote:  
> > > > > > > > > > On Wed, 27 Feb 2019 08:04:08 -0500 "Randall S. Becker"
> > > > > > > > > > <rsbecker@nexbridge.com> wrote:
> > > > > > > > > >  
> > > > > > > > > > > Hi Git Team,
> > > > > > > > > > >
> > > > > > > > > > > I have to admit being perplexed by this one. I have
> > > > > > > > > > > been asked to support the Shift-JIS character set in
> > > > > > > > > > > file contents, comments, and logs, for a partner of
> > > > > > > > > > > mine. I know there are a few ways to do this, but I'm
> > > > > > > > > > > looking for the official non-hacky way  
> > > > > > to do this.  
> > > > > > > > > > > This is CLI only, and our pager, less, does not
> > > > > > > > > > > support multi-byte, so I'm looking  
> > > > > > > > > for  
> > > > > > > > > > options there also.
> > > > > > > > > >
> > > > > > > > > > SJIS is about as much multibyte as UTF-8.
> > > > > > > > > >
> > > > > > > > > > Why do you think less does not support it?
> > > > > > > > > >
> > > > > > > > > > Last time I looked there was SJIS locale for libc so it
> > > > > > > > > > is only matter of generating the correct locales and
> > > > > > > > > > using them. Of course, if you are  
> > > > > > > > > running  
> > > > > > > > > > in UTF-8 SJIS will look like garbage.  
> > > > > > > > >
> > > > > > > > > Sadly, I did not personally build less on this platform,
> > > > > > > > > and the libc used did not include UTF-16, on the platform
> > > > > > > > > vendor supplied less. cat works fine, but the usual
> > > > > > > > > LESSCHARSET=utf-16 is unsupported, so I am looking for an
> > > > > > > > > alternative. THAT is why I think less does not support it.
> > > > > > > > > Sorry, I should have made that more  
> > > > > > clear.  
> > > > > > > > >
> > > > > > > > > cat works fine, so if I set GIT_PAGER=cat, I can at least
> > > > > > > > > see the diffs cleanly in SJIS, but this partner wants a pager that is  
> > usable.  
> > > > > > > > >  
> > > > > > > >
> > > > > > > > So you want to use SJIS because UTF-16 is not supported. So
> > > > > > > > what is the problem with SJIS (or UTF-8 for that matter)?  
> > > > > > >
> > > > > > > The partner I am working with is using multi-byte SJIS, which
> > > > > > > is also not  
> > > > > > supported by this incarnation of less. As a result, UTF-8 does
> > > > > > not work either in this situation. The content is definitely multi-byte.
> > > > > > I know this was fixed in RedHat's Less in 2016, but did not make
> > > > > > this  
> > > > platform.  
> > > > > > >  
> > > > > >
> > > > > > Both UTF-8 and SJIS is multibyte and both is supported by less
> > > > > > in general. If your particular less cannot support it then it is
> > > > > > broken and you should fix it or get it fixed.  
> > > > >
> > > > > To be more specific, the implementation of less' UTF-8 on this
> > > > > platform will  
> > > > present the data as unusable junk as expected. SJIS is multi-byte,
> > > > but is not one of the allowed encodings in less. I am not empowered to  
> > "get it fixed".  
> > > > Thanks for your advice.  
> > > > >  
> > > >
> > > > How is this 'allowed encodings in less' defined?  
> > >
> > > When you run less with LESSCHARSET=encoding, if the encoding is not  
> > known, you get the error:  
> > > invalid charset name
> > >
> > > Doing the due diligence, I actually read the man page on the platform  
> > before asking the question, which listed the following as the only allowed
> > encodings: ascii, iso8859, latin1, latin9, dos, IBM-1047, koi8-r, next, utf-8,
> > windows. The utf-8 variant does not know how to display its multi-byte
> > forms in SJIS, as with other platforms. Does that make sense now?  
> > >  
> > 
> > Does the said man page also mention LESSCHARDEF or LESSOPEN?  
> 
> Of course it does.
> 

So what's the problem with displaying SJIS or even UTF-16 in less, exactly?

Also if you really don't like less there is lv.
Michal
Previous: Randall S. BeckerNext: Randall S. Becker
Message 12 of 18 in “Need multibyte advice - Shift-JIS”
  1. Randall S. BeckerFeb 27, 2019
  2. Michal SuchánekFeb 27, 2019
  3. Randall S. BeckerFeb 27, 2019
  4. Michal SuchánekFeb 27, 2019
  5. Randall S. BeckerFeb 27, 2019
  6. Michal SuchánekFeb 27, 2019
  7. Randall S. BeckerFeb 27, 2019
  8. Michal SuchánekFeb 27, 2019
  9. Randall S. BeckerFeb 27, 2019
  10. Michal SuchánekFeb 27, 2019
  11. Randall S. BeckerFeb 27, 2019
  12. Michal SuchánekFeb 27, 2019
  13. Randall S. BeckerFeb 27, 2019
  14. Michal SuchánekFeb 27, 2019
  15. Randall S. BeckerFeb 27, 2019
  16. Michal SuchánekFeb 27, 2019
  17. Johannes SixtFeb 27, 2019
  18. Randall S. BeckerFeb 27, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.