diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/GridText.c | 8 | ||||
-rw-r--r-- | src/LYCharSets.c | 4 | ||||
-rw-r--r-- | src/LYCharUtils.c | 8 | ||||
-rw-r--r-- | src/UCAux.c | 31 | ||||
-rw-r--r-- | src/UCdomap.c | 10 |
5 files changed, 43 insertions, 18 deletions
diff --git a/src/GridText.c b/src/GridText.c index 88e2efe7..7d15191c 100644 --- a/src/GridText.c +++ b/src/GridText.c @@ -1,5 +1,5 @@ /* - * $LynxId: GridText.c,v 1.328 2021/06/09 23:35:23 tom Exp $ + * $LynxId: GridText.c,v 1.329 2021/06/29 22:01:12 tom Exp $ * * Character grid hypertext object * =============================== @@ -12259,7 +12259,7 @@ void HText_setKcode(HText *text, const char *charset, !strcmp(charset, "x-shift-jis"))) { text->kcode = SJIS; } else if (charset_explicit -#ifdef EXP_JAPANESEUTF8_SUPPORT +#ifdef USE_JAPANESEUTF8_SUPPORT && strcmp(charset, "utf-8") #endif && ((p_in && (p_in->enc == UCT_ENC_CJK)) || @@ -12283,7 +12283,7 @@ void HText_setKcode(HText *text, const char *charset, text->kcode = NOKANJI; if (IS_CJK_TTY) { if (!p_in || ((p_in->enc != UCT_ENC_CJK) -#ifdef EXP_JAPANESEUTF8_SUPPORT +#ifdef USE_JAPANESEUTF8_SUPPORT && (p_in->enc != UCT_ENC_UTF8) #endif )) { @@ -12293,7 +12293,7 @@ void HText_setKcode(HText *text, const char *charset, } if (charset_explicit -#ifdef EXP_JAPANESEUTF8_SUPPORT +#ifdef USE_JAPANESEUTF8_SUPPORT && strcmp(charset, "utf-8") #endif ) { diff --git a/src/LYCharSets.c b/src/LYCharSets.c index c4aeb8e2..94b7a04f 100644 --- a/src/LYCharSets.c +++ b/src/LYCharSets.c @@ -1,5 +1,5 @@ /* - * $LynxId: LYCharSets.c,v 1.70 2020/01/21 21:33:55 tom Exp $ + * $LynxId: LYCharSets.c,v 1.71 2021/06/29 22:01:12 tom Exp $ */ #include <HTUtils.h> #include <HTCJK.h> @@ -523,7 +523,7 @@ void Set_HTCJK(const char *inMIMEname, if (LYRawMode) { if ((!strcmp(inMIMEname, "euc-jp") || -#ifdef EXP_JAPANESEUTF8_SUPPORT +#ifdef USE_JAPANESEUTF8_SUPPORT !strcmp(inMIMEname, "utf-8") || #endif !strcmp(inMIMEname, "shift_jis")) && diff --git a/src/LYCharUtils.c b/src/LYCharUtils.c index bb05aab0..288e5108 100644 --- a/src/LYCharUtils.c +++ b/src/LYCharUtils.c @@ -1,5 +1,5 @@ /* - * $LynxId: LYCharUtils.c,v 1.135 2021/06/09 22:29:03 tom Exp $ + * $LynxId: LYCharUtils.c,v 1.136 2021/06/29 22:01:12 tom Exp $ * * Functions associated with LYCharSets.c and the Lynx version of HTML.c - FM * ========================================================================== @@ -1142,7 +1142,7 @@ char **LYUCFullyTranslateString(char **str, * CJK mode. */ if (IS_CJK_TTY -#ifdef EXP_JAPANESEUTF8_SUPPORT +#ifdef USE_JAPANESEUTF8_SUPPORT && (strcmp(LYCharSet_UC[cs_from].MIMEname, "utf-8") != 0) && (strcmp(LYCharSet_UC[cs_to].MIMEname, "utf-8") != 0) #endif @@ -1390,7 +1390,7 @@ char **LYUCFullyTranslateString(char **str, } else { *(unsigned char *) p = UCH(173); } -#ifdef EXP_JAPANESEUTF8_SUPPORT +#ifdef USE_JAPANESEUTF8_SUPPORT } else if (output_utf8) { if ((!strcmp(LYCharSet_UC[cs_from].MIMEname, "euc-jp") && (IS_EUC((unsigned char) (*p), @@ -2179,7 +2179,7 @@ void LYHandleMETA(HTStructured * me, const BOOL *present, UCT_SETBY_DEFAULT); } if ((p_in->enc != UCT_ENC_CJK) -#ifdef EXP_JAPANESEUTF8_SUPPORT +#ifdef USE_JAPANESEUTF8_SUPPORT && (p_in->enc != UCT_ENC_UTF8) #endif ) { diff --git a/src/UCAux.c b/src/UCAux.c index 5d7b70a4..9ae85b32 100644 --- a/src/UCAux.c +++ b/src/UCAux.c @@ -1,5 +1,5 @@ /* - * $LynxId: UCAux.c,v 1.52 2021/06/09 22:29:39 tom Exp $ + * $LynxId: UCAux.c,v 1.56 2021/06/30 16:53:30 tom Exp $ */ #include <HTUtils.h> @@ -16,7 +16,7 @@ BOOL UCCanUniTranslateFrom(int from) { if (from < 0) return NO; -#ifndef EXP_JAPANESEUTF8_SUPPORT +#ifndef USE_JAPANESEUTF8_SUPPORT if (LYCharSet_UC[from].enc == UCT_ENC_CJK) return NO; #endif @@ -197,7 +197,14 @@ void UCSetTransParams(UCTransParams * pT, int cs_in, /* * Set this element if we want to treat the input as CJK. - FM */ - pT->do_cjk = (BOOL) ((p_in->enc == UCT_ENC_CJK) && IS_CJK_TTY); + pT->do_cjk = (BOOL) ((p_in->enc == UCT_ENC_CJK) && + ( + IS_CJK_TTY +#ifdef EXP_CHINESEUTF8_SUPPORT + || !strcmp(p_in->MIMEname, "euc-cn") +#endif + ) + ); /* * Set these elements based on whether we are dealing with UTF-8. - FM */ @@ -209,6 +216,11 @@ void UCSetTransParams(UCTransParams * pT, int cs_in, * a CJK output (IS_CJK_TTY). - FM */ pT->trans_to_uni = FALSE; +#ifdef EXP_CHINESEUTF8_SUPPORT + if (!strcmp(p_in->MIMEname, "euc-cn")) { + pT->trans_to_uni = (BOOL) UCCanUniTranslateFrom(cs_in); + } +#endif pT->do_8bitraw = FALSE; pT->pass_160_173_raw = TRUE; pT->use_raw_char_in = FALSE; /* Not used for CJK. - KW */ @@ -288,6 +300,19 @@ void UCSetTransParams(UCTransParams * pT, int cs_in, UCCanTranslateUniTo(cs_out)); } } + CTRACE((tfp, "UCSetTransParams (done):\n")); + CTRACE((tfp, " transp: %d\n", pT->transp)); + CTRACE((tfp, " do_cjk: %d\n", pT->do_cjk)); + CTRACE((tfp, " decode_utf8: %d\n", pT->decode_utf8)); + CTRACE((tfp, " output_utf8: %d\n", pT->output_utf8)); + CTRACE((tfp, " do_8bitraw: %d\n", pT->do_8bitraw)); + CTRACE((tfp, " use_raw_char_in: %d\n", pT->use_raw_char_in)); + CTRACE((tfp, " strip_raw_char_in: %d\n", pT->strip_raw_char_in)); + CTRACE((tfp, " pass_160_173_raw: %d\n", pT->pass_160_173_raw)); + CTRACE((tfp, " trans_to_uni: %d\n", pT->trans_to_uni)); + CTRACE((tfp, " trans_C0_to_uni: %d\n", pT->trans_C0_to_uni)); + CTRACE((tfp, " repl_translated_C0: %d\n", pT->repl_translated_C0)); + CTRACE((tfp, " trans_from_uni: %d\n", pT->trans_from_uni)); } /* diff --git a/src/UCdomap.c b/src/UCdomap.c index 31623e5a..2ccc0a85 100644 --- a/src/UCdomap.c +++ b/src/UCdomap.c @@ -1,5 +1,5 @@ /* - * $LynxId: UCdomap.c,v 1.106 2021/06/09 22:29:08 tom Exp $ + * $LynxId: UCdomap.c,v 1.109 2021/06/30 22:28:59 tom Exp $ * * UCdomap.c * ========= @@ -35,7 +35,7 @@ #include <langinfo.h> #endif -#ifdef EXP_JAPANESEUTF8_SUPPORT +#ifdef USE_JAPANESEUTF8_SUPPORT #include <iconv.h> #endif @@ -940,7 +940,7 @@ int UCTransUniCharStr(char *outbuf, } } if (isdefault || trydefault) { -#ifdef EXP_JAPANESEUTF8_SUPPORT +#ifdef USE_JAPANESEUTF8_SUPPORT if (LYCharSet_UC[charset_out].codepage == 0 && LYCharSet_UC[charset_out].codepoints == 0) { iconv_t cd; @@ -1132,7 +1132,7 @@ int UCTransChar(int ch_in, return rc; } -#ifdef EXP_JAPANESEUTF8_SUPPORT +#if defined(USE_JAPANESEUTF8_SUPPORT) || defined(EXP_CHINESEUTF8_SUPPORT) UCode_t UCTransJPToUni(char *inbuf, int buflen, int charset_in) @@ -1201,7 +1201,7 @@ UCode_t UCTransToUni(int ch_in, inx = 0; } } -#ifdef EXP_JAPANESEUTF8_SUPPORT +#ifdef USE_JAPANESEUTF8_SUPPORT if ((strcmp(LYCharSet_UC[charset_in].MIMEname, "shift_jis") == 0) || (strcmp(LYCharSet_UC[charset_in].MIMEname, "euc-jp") == 0)) { char obuffer[3], *pin, *pout; |