xref: /dflybsd-src/contrib/grep/lib/uniwidth/cjk.h (revision 91b9ed38d3db6a8a8ac5b66da1d43e6e331e259a)
195b7b453SJohn Marino /* Test for CJK encoding.
2*09d4459fSDaniel Fojt    Copyright (C) 2001-2002, 2005-2007, 2009-2020 Free Software Foundation, Inc.
395b7b453SJohn Marino    Written by Bruno Haible <bruno@clisp.org>, 2002.
495b7b453SJohn Marino 
595b7b453SJohn Marino    This program is free software: you can redistribute it and/or modify it
695b7b453SJohn Marino    under the terms of the GNU General Public License as published
795b7b453SJohn Marino    by the Free Software Foundation; either version 3 of the License, or
895b7b453SJohn Marino    (at your option) any later version.
995b7b453SJohn Marino 
1095b7b453SJohn Marino    This program is distributed in the hope that it will be useful,
1195b7b453SJohn Marino    but WITHOUT ANY WARRANTY; without even the implied warranty of
1295b7b453SJohn Marino    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13200fbe8dSJohn Marino    General Public License for more details.
1495b7b453SJohn Marino 
1595b7b453SJohn Marino    You should have received a copy of the GNU General Public License
16*09d4459fSDaniel Fojt    along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
1795b7b453SJohn Marino 
1895b7b453SJohn Marino #include "streq.h"
1995b7b453SJohn Marino 
2095b7b453SJohn Marino static int
is_cjk_encoding(const char * encoding)2195b7b453SJohn Marino is_cjk_encoding (const char *encoding)
2295b7b453SJohn Marino {
2395b7b453SJohn Marino   if (0
2495b7b453SJohn Marino       /* Legacy Japanese encodings */
25cf28ed85SJohn Marino       || STREQ_OPT (encoding, "EUC-JP", 'E', 'U', 'C', '-', 'J', 'P', 0, 0, 0)
2695b7b453SJohn Marino       /* Legacy Chinese encodings */
27cf28ed85SJohn Marino       || STREQ_OPT (encoding, "GB2312", 'G', 'B', '2', '3', '1', '2', 0, 0, 0)
28cf28ed85SJohn Marino       || STREQ_OPT (encoding, "GBK", 'G', 'B', 'K', 0, 0, 0, 0, 0, 0)
29cf28ed85SJohn Marino       || STREQ_OPT (encoding, "EUC-TW", 'E', 'U', 'C', '-', 'T', 'W', 0, 0, 0)
30cf28ed85SJohn Marino       || STREQ_OPT (encoding, "BIG5", 'B', 'I', 'G', '5', 0, 0, 0, 0, 0)
3195b7b453SJohn Marino       /* Legacy Korean encodings */
32cf28ed85SJohn Marino       || STREQ_OPT (encoding, "EUC-KR", 'E', 'U', 'C', '-', 'K', 'R', 0, 0, 0)
33cf28ed85SJohn Marino       || STREQ_OPT (encoding, "CP949", 'C', 'P', '9', '4', '9', 0, 0, 0, 0)
34cf28ed85SJohn Marino       || STREQ_OPT (encoding, "JOHAB", 'J', 'O', 'H', 'A', 'B', 0, 0, 0, 0))
3595b7b453SJohn Marino     return 1;
3695b7b453SJohn Marino   return 0;
3795b7b453SJohn Marino }
38