diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2001-12-18 09:28:27 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2001-12-18 09:28:27 +0800 |
commit | f6408daa103092f18789a719a4123224b259f71f (patch) | |
tree | 838b491516e1b3669428136d73019aa9afe5f2c3 /camel/camel-charset-map.c | |
parent | 13299ab7e073cf4d412cec019e4240a7634c1cf5 (diff) | |
download | gsoc2013-evolution-f6408daa103092f18789a719a4123224b259f71f.tar gsoc2013-evolution-f6408daa103092f18789a719a4123224b259f71f.tar.gz gsoc2013-evolution-f6408daa103092f18789a719a4123224b259f71f.tar.bz2 gsoc2013-evolution-f6408daa103092f18789a719a4123224b259f71f.tar.lz gsoc2013-evolution-f6408daa103092f18789a719a4123224b259f71f.tar.xz gsoc2013-evolution-f6408daa103092f18789a719a4123224b259f71f.tar.zst gsoc2013-evolution-f6408daa103092f18789a719a4123224b259f71f.zip |
New function to map ISO charsets to the Windows charsets.
2001-12-17 Jeffrey Stedfast <fejj@ximian.com>
* camel-charset-map.c (camel_charset_iso_to_windows): New function
to map ISO charsets to the Windows charsets.
* camel-mime-part-utils.c (broken_windows_charset): Detect Windows
charsets.
(simple_data_wrapper_construct_from_parser): Simplify a tad and
also check for iso-8859-* charsets that are really Windows
charsets. Fixes bug #12631.
svn path=/trunk/; revision=15144
Diffstat (limited to 'camel/camel-charset-map.c')
-rw-r--r-- | camel/camel-charset-map.c | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/camel/camel-charset-map.c b/camel/camel-charset-map.c index 17962d74be..2416dd2504 100644 --- a/camel/camel-charset-map.c +++ b/camel/camel-charset-map.c @@ -292,5 +292,60 @@ camel_charset_best (const char *in, int len) return camel_charset_best_name (&charset); } + +/** + * camel_charset_iso_to_windows: + * @isocharset: an ISO charset + * + * Returns the equivalent Windows charset. + **/ +const char * +camel_charset_iso_to_windows (const char *isocharset) +{ + /* According to http://czyborra.com/charsets/codepages.html, + * the charset mapping is as follows: + * + * iso-8859-1 maps to windows-cp1252 + * iso-8859-2 maps to windows-cp1250 + * iso-8859-3 maps to windows-cp???? + * iso-8859-4 maps to windows-cp???? + * iso-8859-5 maps to windows-cp1251 + * iso-8859-6 maps to windows-cp1256 + * iso-8859-7 maps to windows-cp1253 + * iso-8859-8 maps to windows-cp1255 + * iso-8859-9 maps to windows-cp1254 + * iso-8859-10 maps to windows-cp???? + * iso-8859-11 maps to windows-cp???? + * iso-8859-12 maps to windows-cp???? + * iso-8859-13 maps to windows-cp1257 + * + * Assumptions: + * - I'm going to assume that since iso-8859-4 and + * iso-8859-13 are Baltic that it also maps to + * windows-cp1257. + */ + + if (!strcasecmp (isocharset, "iso-8859-1")) + return "windows-cp1252"; + else if (!strcasecmp (isocharset, "iso-8859-2")) + return "windows-cp1250"; + else if (!strcasecmp (isocharset, "iso-8859-4")) + return "windows-cp1257"; + else if (!strcasecmp (isocharset, "iso-8859-5")) + return "windows-cp1251"; + else if (!strcasecmp (isocharset, "iso-8859-6")) + return "windows-cp1256"; + else if (!strcasecmp (isocharset, "iso-8859-7")) + return "windows-cp1253"; + else if (!strcasecmp (isocharset, "iso-8859-8")) + return "windows-cp1255"; + else if (!strcasecmp (isocharset, "iso-8859-9")) + return "windows-cp1254"; + else if (!strcasecmp (isocharset, "iso-8859-13")) + return "windows-cp1257"; + + return isocharset; +} + #endif /* !BUILD_MAP */ |