Bug 220013 - editors/nvi-m17n [patch] fix CJK display problem caused by libncurses
Summary: editors/nvi-m17n [patch] fix CJK display problem caused by libncurses
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Steve Wills
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2017-06-15 13:28 UTC by Yasuhito FUTATSUKI
Modified: 2018-06-16 22:48 UTC (History)
2 users (show)

See Also:


Attachments
patch to fix to link libncursesw (390 bytes, text/plain)
2017-06-15 13:28 UTC, Yasuhito FUTATSUKI
no flags Details
patch to avoid linking libncurses and use libncursesw instead (1.44 KB, patch)
2017-06-15 21:36 UTC, Yasuhito FUTATSUKI
no flags Details | Diff
fileencoding misdetection when the first line does not contain multi-byte letters (1.13 KB, patch)
2017-11-17 14:29 UTC, Satoshi TOMIOKA
no flags Details | Diff
patch to correct detection of fileencoding and to avoid disappeared some symbols (1.81 KB, patch)
2017-11-28 13:23 UTC, Satoshi TOMIOKA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yasuhito FUTATSUKI 2017-06-15 13:28:18 UTC
Created attachment 183498 [details]
patch to fix to link libncursesw

nvi-m17n links libncurses, not libncursesw. So it cannot display CJK characters correctly on FreeBSD >= 11.0

The patch attached (against editors/nvi-m17n) fixes nvi to link libncursesw instead of libncurses.
Comment 1 Yasuhito FUTATSUKI 2017-06-15 21:36:42 UTC
Created attachment 183510 [details]
patch to avoid linking libncurses and use libncursesw instead
Comment 2 Yasuhito FUTATSUKI 2017-06-17 10:05:06 UTC
the patch fixes the behavior in displayencoding=euc-jp (and parhaps other 8bit encodings), but cannot fix iso-2022 encodings.

I think it is caused by ncurses don't support iso-2022 encodings (by accident or dropping support, I don't know which is).
Comment 3 Satoshi TOMIOKA 2017-11-17 14:17:13 UTC
In FreeBSD 11.1, nvi-m17n cannot set the "fileencoding" for euc-jp file correctly, when the first line does not contain multi-byte characters. 

The patch attached may fix this bug.
The correction is made by only a single line addition to the multibyte.c but it requires libncursesw.
Comment 4 Satoshi TOMIOKA 2017-11-17 14:29:37 UTC
Created attachment 188075 [details]
fileencoding misdetection when the first line does not contain multi-byte letters

In FreeBSD 11.1, nvi-m17n cannot set the "fileencoding" for euc-jp file correctly, when the first line does not include multi-byte characters. 
In the current code, all the candidate flags are set for this case, and the encoding is determined to the encoding of the first candidate within all the candidates.

The patch attached may fix this bug.
The correction is made by only a single line addition to the multibyte.c but it requires libncursesw.
Comment 5 Satoshi TOMIOKA 2017-11-28 13:23:14 UTC
Created attachment 188352 [details]
patch to correct detection of fileencoding and to avoid disappeared some symbols

In the newest port nvi-m17n (1.79.20040608_4,1), even when the previous patch I uploaded (Comment 4) is applied, there is another problem; some well-used multi-byte symbols, e.g. the circle symbol (ISO-2022-JP code 217b) or the multiplication sign (215f), cannot be displayed.

I guess that this problem is related to ncursew library, although I could not find the way to fix it.
However, this problem can be solved by using the bundled curses codes included in the original ports sources instead of linking /lib/libncursesw.so.8.

The new patch is an accumulated patch to apply to nvi-m17n-1.79.20040608_4,1.
This can fix two problems.
One is to solve the detection error of fileencoding, which is same to the patch uploaded previously (obsoleted).
The other is new patch to solve the disappearing the well-used symbols.
Comment 6 commit-hook freebsd_committer freebsd_triage 2018-06-16 22:47:43 UTC
A commit references this bug:

Author: swills
Date: Sat Jun 16 22:47:22 UTC 2018
New revision: 472573
URL: https://svnweb.freebsd.org/changeset/ports/472573

Log:
  editors/nvi-m17n: fix CJK display problem

  PR:		220013
  Submitted by:	Satoshi TOMIOKA <tomioka.satoshi.ml@gmail.com>
  Reported by:	Yasuhito FUTATSUKI <freebsd-bug-report-yf@yf.bsdclub.org>

Changes:
  head/editors/nvi-m17n/Makefile
  head/editors/nvi-m17n/files/patch-common-multibyte.c
  head/editors/nvi-m17n/files/patch-configure
Comment 7 Steve Wills freebsd_committer freebsd_triage 2018-06-16 22:48:26 UTC
Committed, thanks!