X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=sbr%2Fnorm_charmap.c;h=02e6a3cf29089ca1e22cc51591c7acaa7c90c8d8;hp=8ec544f2377ab3c902a8bcce04ac7217dca7a930;hb=5cb46b33551f28e4168989e752e09bd927e993f9;hpb=a485ed478abbd599d8c9aab48934e7a26733ecb1 diff --git a/sbr/norm_charmap.c b/sbr/norm_charmap.c index 8ec544f..02e6a3c 100644 --- a/sbr/norm_charmap.c +++ b/sbr/norm_charmap.c @@ -1,28 +1,28 @@ /* - * The Single Unix Specification function nl_langinfo(CODESET) - * returns the name of the encoding used by the currently selected - * locale: - * - * http://www.opengroup.org/onlinepubs/7908799/xsh/langinfo.h.html - * - * Unfortunately the encoding names are not yet standardized. - * This function knows about the encoding names used on many - * different systems and converts them where possible into - * the corresponding MIME charset name registered in - * - * http://www.iana.org/assignments/character-sets - * - * Please extend it as needed and suggest improvements to the author. - * - * Markus.Kuhn@cl.cam.ac.uk -- 2002-03-11 - * Permission to use, copy, modify, and distribute this software - * for any purpose and without fee is hereby granted. The author - * disclaims all warranties with regard to this software. - * - * Latest version: - * - * http://www.cl.cam.ac.uk/~mgk25/ucs/norm_charmap.c - */ +** The Single Unix Specification function nl_langinfo(CODESET) +** returns the name of the encoding used by the currently selected +** locale: +** +** http://www.opengroup.org/onlinepubs/7908799/xsh/langinfo.h.html +** +** Unfortunately the encoding names are not yet standardized. +** This function knows about the encoding names used on many +** different systems and converts them where possible into +** the corresponding MIME charset name registered in +** +** http://www.iana.org/assignments/character-sets +** +** Please extend it as needed and suggest improvements to the author. +** +** Markus.Kuhn@cl.cam.ac.uk -- 2002-03-11 +** Permission to use, copy, modify, and distribute this software +** for any purpose and without fee is hereby granted. The author +** disclaims all warranties with regard to this software. +** +** Latest version: +** +** http://www.cl.cam.ac.uk/~mgk25/ucs/norm_charmap.c +*/ #include @@ -38,37 +38,39 @@ norm_charmap(char *name) if (!name) return name; - /* Many need no remapping, but they are listed here so you - * can see what output to expect, and modify for your needs - * as necessary. */ - if (!strcmp(name, "UTF-8")) + /* + ** Many need no remapping, but they are listed here so you + ** can see what output to expect, and modify for your needs + ** as necessary. + */ + if (strcmp(name, "UTF-8")==0) return "UTF-8"; - if (!strcmp(name, "EUC-JP")) + if (strcmp(name, "EUC-JP")==0) return "EUC-JP"; - if (!strcmp(name, "EUC-KR")) + if (strcmp(name, "EUC-KR")==0) return "EUC-KR"; - if (!strcmp(name, "EUC-TW")) + if (strcmp(name, "EUC-TW")==0) return "EUC-TW"; - if (!strcmp(name, "KOI8-R")) + if (strcmp(name, "KOI8-R")==0) return "KOI8-R"; - if (!strcmp(name, "KOI8-U")) + if (strcmp(name, "KOI8-U")==0) return "KOI8-U"; - if (!strcmp(name, "GBK")) + if (strcmp(name, "GBK")==0) return "GBK"; - if (!strcmp(name, "GB2312")) + if (strcmp(name, "GB2312")==0) return "GB2312"; - if (!strcmp(name, "GB18030")) + if (strcmp(name, "GB18030")==0) return "GB18030"; - if (!strcmp(name, "VSCII")) + if (strcmp(name, "VSCII")==0) return "VSCII"; /* ASCII comes in many names */ - if (!strcmp(name, "ASCII") || - !strcmp(name, "US-ASCII") || - !strcmp(name, "ANSI_X3.4-1968") || - !strcmp(name, "646") || - !strcmp(name, "ISO646") || - !strcmp(name, "ISO_646.IRV")) + if (strcmp(name, "ASCII")==0 || + strcmp(name, "US-ASCII")==0 || + strcmp(name, "ANSI_X3.4-1968")==0 || + strcmp(name, "646")==0 || + strcmp(name, "ISO646")==0 || + strcmp(name, "ISO_646.IRV")==0) return "US-ASCII"; /* ISO 8859 will be converted to "ISO-8859-x" */ @@ -96,19 +98,21 @@ norm_charmap(char *name) } /* TIS-620 comes in at least the following two forms */ - if (!strcmp(name, "TIS-620") || - !strcmp(name, "TIS620.2533")) + if (strcmp(name, "TIS-620")==0 || + strcmp(name, "TIS620.2533")==0) return "ISO-8859-11"; /* For some, uppercase/lowercase might differ */ - if (!strcmp(name, "Big5") || !strcmp(name, "BIG5")) + if (strcmp(name, "Big5")==0 || strcmp(name, "BIG5")==0) return "Big5"; - if (!strcmp(name, "Big5HKSCS") || !strcmp(name, "BIG5HKSCS")) + if (strcmp(name, "Big5HKSCS")==0 || strcmp(name, "BIG5HKSCS")==0) return "Big5HKSCS"; - /* I don't know of any implementation of nl_langinfo(CODESET) out - * there that returns anything else (and I'm not even certain all of - * the above occur in the wild), but just in case, as a fallback, - * return the unmodified name. */ + /* + ** I don't know of any implementation of nl_langinfo(CODESET) out + ** there that returns anything else (and I'm not even certain all of + ** the above occur in the wild), but just in case, as a fallback, + ** return the unmodified name. + */ return name; }