#73608 [Patch] CJK support

Package:
links
Source:
links2
Description:
Web browser running in text mode
Submitter:
Anthony Wong
Date:
2025-01-20 04:21:01 UTC
Severity:
wishlist
Tags:
#73608#5
Date:
2000-10-03 20:11:18 UTC
From:
To:
I have created a CJK patch such that links can display CJK correctly.
It has been used by me for quite some time now. It has been sent to
the links mailing list but seems to be ignored somehow... Thanks if it
can be included in Debian.

*** links-0.92-cjk.patch
diff -uNr links-0.92.orig/charsets.c links-0.92/charsets.c
--- links-0.92.orig/charsets.c	Sat Sep  9 09:20:57 2000
+++ links-0.92/charsets.c	Sat Sep  9 09:51:22 2000
@@ -94,7 +94,7 @@
 	int j, s;
 	if (u < 128) return strings[u];
 	if (u == 0xa0) return "\001";
-	if (u == 0xad) return "";
+        if (!is_cjk_cp(to) && u == 0xad) return "";
 	if (u < 0xa0) {
 		if (!strange_chars[u - 0x80]) return NULL;
 		return u2cp(strange_chars[u - 0x80], to);
@@ -359,4 +359,9 @@
 int is_cp_special(int index)
 {
 	return codepages[index].table == table_utf_8;
+}
+
+int is_cjk_cp(int index)
+{
+	return ! strcmp(codepages[index].name, "CJK");
 }
diff -uNr links-0.92.orig/codepage.inc links-0.92/codepage.inc
--- links-0.92.orig/codepage.inc	Fri Jun 30 06:03:44 2000
+++ links-0.92/codepage.inc	Sat Sep  9 09:50:07 2000
@@ -2208,6 +2208,8 @@

 unsigned char *aliases_utf_8 [] = {"utf-8", "utf8", NULL };

+unsigned char *aliases_cjk [] = {"BIG-5", "BIG5", "GB-2312", "GB2312", "JIS", "SJIS", "X-SJIS", "Shift_JIS", "iso-2022-jp", "euc-kr", NULL };
+
 struct codepage_desc codepages [] = {
 	"7-bit ASCII", aliases_7bit, table_7bit,
 	"ISO 8859-1", aliases_8859_1, table_8859_1,
@@ -2228,5 +2230,6 @@
 	"KOI8-R", aliases_koi8_r, table_koi8_r,
 	"KOI8-U", aliases_koi8_u, table_koi8_u,
 	"Unicode UTF-8", aliases_utf_8, table_utf_8,
+	"CJK", aliases_cjk, table_8859_1,
 	NULL, NULL, NULL
 };
diff -uNr links-0.92.orig/links.h links-0.92/links.h
--- links-0.92.orig/links.h	Mon Jun 19 00:36:55 2000
+++ links-0.92/links.h	Sat Sep  9 09:43:25 2000
@@ -1651,6 +1651,7 @@
 unsigned char *get_cp_name(int);
 unsigned char *get_cp_mime_name(int);
 int is_cp_special(int);
+int is_cjk_cp(int);
 void free_conv_table();

 /* view.c */

#73608#10
Date:
2000-10-04 14:33:10 UTC
From:
To:
Yes it can, it was actually in my hold queue, but I was worrying about
not being able to test it. I'll contact you about it. I'm a bit busy
at the moment, but trying to get some time this week about it.

(The SSL version can be checked at the usual url seen in the README.debian)

#73608#19
Date:
2025-01-19 22:02:28 UTC
From:
To:
It looks like this was not applied, or maybe it's gone again in the
current sources.

Is this patch still relevant?

Chris

#73608#24
Date:
2025-01-20 03:53:39 UTC
From:
To:
I haven't used links for long time. I just installed links and it
still can't display Chinese, so this patch is still relevant. However,
I just tried and it no longer applies cleanly and would need
reworking:

checking file charsets.c
Hunk #1 FAILED at 94.
Hunk #2 FAILED at 359.
2 out of 2 hunks FAILED
checking file codepage.inc
Hunk #1 FAILED at 2208.
Hunk #2 FAILED at 2228.
2 out of 2 hunks FAILED
checking file links.h
Hunk #1 FAILED at 1651.
1 out of 1 hunk FAILED

Unfortunately, as I’m no longer actively using links, this would need
someone else to pick it up.