1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
|
Forwarded: not-needed
From: Aron Xu <aron@debian.org>
Date: Sat, 9 Jun 2012 02:42:21 +0800
Subject: [PATCH] better jp and ko handling
Last-Update: 2018-08-06
---
doc/zhcon.1.in | 4 ++--
src/encfilter.c | 4 ++++
src/iconv_string.c | 6 ++++++
src/zhcon.conf | 2 +-
src/zhcon.cpp | 2 +-
5 files changed, 14 insertions(+), 4 deletions(-)
--- a/doc/zhcon.1.in
+++ b/doc/zhcon.1.in
@@ -18,7 +18,7 @@
* Full support for Linux FrameBuffer device(from 640x480x8bpp to 1024x768x32bpp)
-* Multiple language support (GB2312, GBK, BIG5, JIS, KSCM)
+* Multiple language support (GB2312, GBK, BIG5, JIS, KSC)
* Gpm mouse support under GNU/Linux (in progress)
@@ -63,7 +63,7 @@
.br
CTRL_F4: set encode to JIS
.br
-CTRL_F5: set encode to KSCM
+CTRL_F5: set encode to KSC
.br
CTRL_F7: toggle between nativebar and overspot input style
.br
--- a/src/encfilter.c
+++ b/src/encfilter.c
@@ -63,6 +63,10 @@
int SetupEncodingFilter(const char* sysCoding)
{
+ /* For better support of JP and KR. */
+ if(!strcmp(sysCoding, "jis")) sysCoding = "EUC-JP";
+ if(!strcmp(sysCoding, "ksc")) sysCoding = "EUC-KR";
+
#ifdef __GLIBC__
if (! strstr(sysCoding, "//TRANSLIT")) {
char *sysCodingTranslit;
--- a/src/iconv_string.c
+++ b/src/iconv_string.c
@@ -14,6 +14,12 @@
const char* start, const char* end,
char** resultp, size_t* lengthp)
{
+ /* For better support for JP and KR. */
+ if (!strcmp(tocode, "ksc")) tocode = "EUC-KR";
+ if (!strcmp(fromcode, "ksc")) fromcode = "EUC-KR";
+ if (!strcmp(tocode, "jis")) tocode = "EUC-JP";
+ if (!strcmp(fromcode, "jis")) fromcode = "EUC-JP";
+
iconv_t cd = iconv_open(tocode,fromcode);
size_t length;
char* result;
--- a/src/zhcon.conf
+++ b/src/zhcon.conf
@@ -8,7 +8,7 @@
uniconpath = /usr/lib/unicon/
#defaultencode: default encoding can be :gb2312,gbk,big5,jis,ksc
-defaultencode = gb2312
+defaultencode = gbk
#autoencode: auto detect current Chinese encoding(GB2312 or BIG5)
#when autoencode is set zhcon will try to detect current Chinese encoding
--- a/src/zhcon.cpp
+++ b/src/zhcon.cpp
@@ -668,7 +668,7 @@
} else if (s == "ksc") {
//SetEncode(KSC,KSC);
setenv("LC_CTYPE", "ko", 1);
- mDefaultEncode = GBK;
+ mDefaultEncode = KSC;
} else {
throw runtime_error("unable to set default encode!");
}
|