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

Re: Need multibyte advice - Shift-JIS

From
Johannes Sixt <j6t@kdbg.org>
Date
Feb 27, 2019, 19:36 UTC
Message-ID
<d3b76f4f-29b7-663e-ca3b-c15b1345a133@kdbg.org>
In-Reply-To
<003301d4cecd$4bced250$e36c76f0$@nexbridge.com>
Am 27.02.19 um 19:50 schrieb Randall S. Becker:
Show 7 quoted lines
> On February 27, 2019 13:18, Michal Suchánek wrote:
>> What are your requirements, exactly?
> Source code and comments contain SJIS content. The requirement is to
> be able to move seamlessly in and out of git, and have git show/diff/log
> display SJIS as well as ASCII content. How that happens is open. The
> UTF-16 is a red-herring, only as an attempt at getting at SJIS content
> differently than the limitation imposed by less.

When your file content contains ShiftJIS, you should set an attribute in .gitattributes:

*.sourcecode	encoding=ShiftJIS
When your git commits messages contain ShiftJIS, you should configure
 git config i18n.commitEncoding ShiftJIS

More precisely, this assumes that your editor that composes to commits messages writes the .git/COMMIT_MSG in ShiftJIS.

When your terminal or pager is configured that it interprets the byte stream that it receives from applications for display as ShiftJIS, then you should configure

 git config i18n.logOutputEncoding ShiftJIS

You can set this independently from the other settings. In particular, when it is not set, UTF-8 is assumed. That is, if your terminal or pager supports UTF-8, you should *NOT* set this configuration (or set it to UTF-8).

And, of course, you must have built Git with iconv, which must have support for ShiftJIS.

-- Hannes
Previous: Michal SuchánekNext: Randall S. Becker
Message 17 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.