diff --git a/include/m_ctype.h b/include/m_ctype.h
index 69a2e025a11..70551f31c57 100644
--- a/include/m_ctype.h
+++ b/include/m_ctype.h
@@ -49,6 +49,9 @@ typedef struct unicase_info_st {
 #define MY_CS_INDEX     4      /* sets listed in the Index file  */
 #define MY_CS_LOADED    8      /* sets that are currently loaded */
 
+#define MY_CHARSET_UNDEFINED 0
+#define MY_CHARSET_CURRENT (default_charset_info->number)
+
 
 typedef struct my_uni_idx_st {
   uint16 from;
@@ -112,18 +115,12 @@ typedef struct charset_info_st
   char    max_sort_char; /* For LIKE optimization */
 } CHARSET_INFO;
 
-/* strings/ctype.c */
+
 extern CHARSET_INFO *default_charset_info;
 extern CHARSET_INFO *system_charset_info;
-extern CHARSET_INFO *find_compiled_charset(uint cs_number);
-extern CHARSET_INFO *find_compiled_charset_by_name(const char *name);
-extern CHARSET_INFO  compiled_charsets[];
-extern CHARSET_INFO  all_charsets[256];
-extern uint compiled_charset_number(const char *name);
-extern const char *compiled_charset_name(uint charset_number);
+extern CHARSET_INFO *all_charsets[256];
+extern my_bool init_compiled_charsets(myf flags);
 
-#define MY_CHARSET_UNDEFINED 0
-#define MY_CHARSET_CURRENT (default_charset_info->number)
 
 /* declarations for simple charsets */
 extern int  my_strnxfrm_simple(CHARSET_INFO *, uchar *, uint, const uchar *, uint); 
@@ -153,185 +150,6 @@ extern int my_strcasecmp_mb(CHARSET_INFO * cs,const char *, const char *);
 extern int my_strncasecmp_mb(CHARSET_INFO * cs,const char *, const char *t, uint);
 #endif
 
-#ifdef HAVE_CHARSET_big5
-/* declarations for the big5 character set */
-extern uchar ctype_big5[], to_lower_big5[], to_upper_big5[], sort_order_big5[];
-extern int     my_strnncoll_big5(CHARSET_INFO *,const uchar *, uint, const uchar *, uint);
-extern int     my_strnxfrm_big5(CHARSET_INFO *,uchar *, uint, const uchar *, uint);
-extern my_bool my_like_range_big5(CHARSET_INFO *,const char *, uint, pchar, uint,
-                          char *, char *, uint *, uint *);
-extern int     ismbchar_big5(CHARSET_INFO *, const char *, const char *);
-extern my_bool ismbhead_big5(CHARSET_INFO *, uint);
-extern int     mbcharlen_big5(CHARSET_INFO *, uint);
-int my_mb_wc_big5(CHARSET_INFO *cs,my_wc_t *wc, const uchar *s,const uchar *e);
-int my_wc_mb_big5(CHARSET_INFO *cs,my_wc_t wc, uchar *s, uchar *e);
-#endif
-
-#ifdef HAVE_CHARSET_czech
-/* declarations for the czech character set */
-extern uchar ctype_czech[], to_lower_czech[], to_upper_czech[], sort_order_czech[];
-extern int     my_strnncoll_czech(CHARSET_INFO *, const uchar *, uint, const uchar *, uint);
-extern int     my_strnxfrm_czech(CHARSET_INFO *, uchar *, uint, const uchar *, uint);
-extern my_bool my_like_range_czech(CHARSET_INFO *, 
-                          const char *, uint, pchar, uint,
-                          char *, char *, uint *, uint *);
-#endif
-
-
-#ifdef HAVE_CHARSET_win1250ch
-/* declarations for the win1250ch character set */
-extern uchar ctype_win1250ch[];
-extern uchar to_lower_win1250ch[];
-extern uchar to_upper_win1250ch[];
-extern uchar sort_order_win1250ch[];
-extern int     my_strnncoll_win1250ch(CHARSET_INFO *, const uchar *, uint, const uchar *, uint);
-extern int     my_strnxfrm_win1250ch(CHARSET_INFO *, uchar *, uint, const uchar *, uint);
-extern my_bool my_like_range_win1250ch(CHARSET_INFO *, 
-                          const char *, uint, pchar, uint,
-                          char *, char *, uint *, uint *);
-#endif
-
-
-#ifdef HAVE_CHARSET_euc_kr
-/* declarations for the euc_kr character set */
-extern uchar ctype_euc_kr[], to_lower_euc_kr[], to_upper_euc_kr[], sort_order_euc_kr[];
-extern int     ismbchar_euc_kr(CHARSET_INFO *, const char *, const char *);
-extern my_bool ismbhead_euc_kr(CHARSET_INFO *, uint);
-extern int     mbcharlen_euc_kr(CHARSET_INFO *, uint);
-int my_mb_wc_euc_kr(CHARSET_INFO *cs,my_wc_t *wc, const uchar *s,const uchar *e);
-int my_wc_mb_euc_kr(CHARSET_INFO *cs,my_wc_t wc, uchar *s, uchar *e);
-#endif
-
-#ifdef HAVE_CHARSET_gb2312
-/* declarations for the gb2312 character set */
-extern uchar ctype_gb2312[], to_lower_gb2312[], to_upper_gb2312[], sort_order_gb2312[];
-extern int     ismbchar_gb2312(CHARSET_INFO *, const char *, const char *);
-extern my_bool ismbhead_gb2312(CHARSET_INFO *, uint);
-extern int     mbcharlen_gb2312(CHARSET_INFO *, uint);
-int my_mb_wc_gb2312(CHARSET_INFO *cs,my_wc_t *wc, const uchar *s,const uchar *e);
-int my_wc_mb_gb2312(CHARSET_INFO *cs,my_wc_t wc, uchar *s, uchar *e);
-#endif
-
-#ifdef HAVE_CHARSET_gbk
-/* declarations for the gbk character set */
-extern uchar ctype_gbk[], to_lower_gbk[], to_upper_gbk[], sort_order_gbk[];
-extern int     my_strnncoll_gbk(CHARSET_INFO *, const uchar *, uint, const uchar *, uint);
-extern int     my_strnxfrm_gbk(CHARSET_INFO *, uchar *, uint, const uchar *, uint);
-extern my_bool my_like_range_gbk(CHARSET_INFO *, const char *, uint, pchar, uint,
-                          char *, char *, uint *, uint *);
-extern int     ismbchar_gbk(CHARSET_INFO *, const char *, const char *);
-extern my_bool ismbhead_gbk(CHARSET_INFO *, uint);
-extern int     mbcharlen_gbk(CHARSET_INFO *, uint);
-int my_mb_wc_gbk(CHARSET_INFO *cs,my_wc_t *wc, const uchar *s,const uchar *e);
-int my_wc_mb_gbk(CHARSET_INFO *cs,my_wc_t wc, uchar *s, uchar *e);
-#endif
-
-#ifdef HAVE_CHARSET_latin1_de
-/* declarations for the latin1_de character set */
-extern uchar ctype_latin1_de[], to_lower_latin1_de[], to_upper_latin1_de[], sort_order_latin1_de[];
-extern int     my_strnncoll_latin1_de(CHARSET_INFO *, const uchar *, uint, const uchar *, uint);
-extern int     my_strnxfrm_latin1_de(CHARSET_INFO *, uchar *, uint, const uchar *, uint);
-extern my_bool my_like_range_latin1_de(CHARSET_INFO *, const char *, uint, pchar, uint,
-                          char *, char *, uint *, uint *);
-#endif
-
-#ifdef HAVE_CHARSET_sjis
-/* declarations for the sjis character set */
-extern uchar ctype_sjis[], to_lower_sjis[], to_upper_sjis[], sort_order_sjis[];
-extern int     my_strnncoll_sjis(CHARSET_INFO *, const uchar *, uint, const uchar *, uint);
-extern int     my_strnxfrm_sjis(CHARSET_INFO *, uchar *, uint, const uchar *, uint);
-extern my_bool my_like_range_sjis(CHARSET_INFO *, const char *, uint, pchar, uint,
-                          char *, char *, uint *, uint *);
-extern int     ismbchar_sjis(CHARSET_INFO *, const char *, const char *);
-extern my_bool ismbhead_sjis(CHARSET_INFO *, uint);
-extern int     mbcharlen_sjis(CHARSET_INFO *, uint);
-int my_mb_wc_sjis(CHARSET_INFO *cs,my_wc_t *wc, const uchar *s,const uchar *e);
-int my_wc_mb_sjis(CHARSET_INFO *cs,my_wc_t wc, uchar *s, uchar *e);
-#endif
-
-#ifdef HAVE_CHARSET_tis620
-/* declarations for the tis620 character set */
-extern uchar ctype_tis620[], to_lower_tis620[], to_upper_tis620[], sort_order_tis620[];
-extern int     my_strnncoll_tis620(CHARSET_INFO *, const uchar *, uint, const uchar *, uint);
-extern int     my_strnxfrm_tis620(CHARSET_INFO *, uchar *, uint, const uchar *, uint);
-extern my_bool my_like_range_tis620(CHARSET_INFO *, const char *, uint, pchar, uint,
-                          char *, char *, uint *, uint *);
-#endif
-
-#ifdef HAVE_CHARSET_ujis
-/* declarations for the ujis character set */
-extern uchar ctype_ujis[], to_lower_ujis[], to_upper_ujis[], sort_order_ujis[];
-extern int     ismbchar_ujis(CHARSET_INFO *, const char *, const char *);
-extern my_bool ismbhead_ujis(CHARSET_INFO *, uint);
-extern int     mbcharlen_ujis(CHARSET_INFO *, uint);
-int my_mb_wc_euc_jp(CHARSET_INFO *cs,my_wc_t *wc, const uchar *s,const uchar *e);
-int my_wc_mb_euc_jp(CHARSET_INFO *cs,my_wc_t wc, uchar *s, uchar *e);
-#endif
-
-#ifdef HAVE_CHARSET_utf8
-
-extern uchar ctype_utf8[];
-extern uchar to_lower_utf8[];
-extern uchar to_upper_utf8[];
-
-int my_strnncoll_utf8(CHARSET_INFO *cs,
-                      const uchar *s, uint s_len, const uchar *t, uint t_len);
-
-int my_strnxfrm_utf8(CHARSET_INFO *cs,
-        uchar *dest, uint destlen, const uchar *src, uint srclen);
-
-int my_ismbchar_utf8(CHARSET_INFO *cs, const char *b, const char *e);
-my_bool my_ismbhead_utf8(CHARSET_INFO * cs, uint ch);
-int my_mbcharlen_utf8(CHARSET_INFO *cs, uint c);
-
-void my_caseup_str_utf8(CHARSET_INFO * cs, char * s);
-void my_casedn_str_utf8(CHARSET_INFO *cs, char * s);
-void my_caseup_utf8(CHARSET_INFO *cs, char *s, uint len);
-void my_casedn_utf8(CHARSET_INFO *cs, char *s, uint len);
-
-int my_strcasecmp_utf8(CHARSET_INFO *cs, const char *s, const char *t);
-int my_strncasecmp_utf8(CHARSET_INFO *cs, const char *s,const char *t,uint l);
-
-int my_utf8_uni (CHARSET_INFO *cs, my_wc_t *p, const uchar *s, const uchar *e);
-int my_uni_utf8 (CHARSET_INFO *cs, my_wc_t wc, uchar *b, uchar *e);
-
-uint my_hash_caseup_utf8(struct charset_info_st *cs, const byte *key, uint len);
-void my_hash_sort_utf8(struct charset_info_st *cs, const uchar *key, uint len, ulong *nr1, ulong *nr2); 
-   
-#endif
-
-
-#ifdef HAVE_CHARSET_ucs2
-
-extern uchar ctype_ucs2[];
-extern uchar to_lower_ucs2[];
-extern uchar to_upper_ucs2[];
-
-int my_strnncoll_ucs2(CHARSET_INFO *cs,
-                      const uchar *s, uint s_len, const uchar *t, uint t_len);
-
-int my_strnxfrm_ucs2(CHARSET_INFO *cs,
-        uchar *dest, uint destlen, const uchar *src, uint srclen);
-
-int my_ismbchar_ucs2(CHARSET_INFO *cs, const char *b, const char *e);
-my_bool my_ismbhead_ucs2(CHARSET_INFO * cs, uint ch);
-int my_mbcharlen_ucs2(CHARSET_INFO *cs, uint c);
-
-void my_caseup_str_ucs2(CHARSET_INFO * cs, char * s);
-void my_casedn_str_ucs2(CHARSET_INFO *cs, char * s);
-void my_caseup_ucs2(CHARSET_INFO *cs, char *s, uint len);
-void my_casedn_ucs2(CHARSET_INFO *cs, char *s, uint len);
-
-int my_strcasecmp_ucs2(CHARSET_INFO *cs, const char *s, const char *t);
-int my_strncasecmp_ucs2(CHARSET_INFO *cs, const char *s,const char *t,uint l);
-
-int my_ucs2_uni (CHARSET_INFO *cs, my_wc_t *p, const uchar *s, const uchar *e);
-int my_uni_ucs2 (CHARSET_INFO *cs, my_wc_t wc, uchar *b, uchar *e);
-
-uint my_hash_caseup_ucs2(struct charset_info_st *cs, const byte *key, uint len);
-void my_hash_sort_ucs2(struct charset_info_st *cs, const uchar *key, uint len, ulong *nr1, ulong *nr2); 
-   
-#endif
 
 
 #define	_U	01	/* Upper case */
diff --git a/mysys/charset.c b/mysys/charset.c
index 7d58f7588b4..742163e9220 100644
--- a/mysys/charset.c
+++ b/mysys/charset.c
@@ -23,7 +23,6 @@
 
 const char *charsets_dir = NULL;
 static int charset_initialized=0;
-CHARSET_INFO all_charsets[256];
 
 #define MAX_LINE  1024
 
@@ -111,17 +110,25 @@ static my_bool read_charset_index(myf myflags)
       my_fclose(fb.f,myflags);
       return TRUE;
     }
-
-    cs=&all_charsets[csnum];
     
-    if (!(cs->name=
-           (char*) my_once_alloc(length= (uint) strlen(buf)+1, myflags)))
+    if (all_charsets[csnum])
+      continue;
+    
+    if (!(cs=(CHARSET_INFO*) my_once_alloc(sizeof(cs[0]),myflags)))
+    {
+      my_fclose(fb.f,myflags);
+      return TRUE;
+    }
+    bzero(cs,sizeof(cs[0]));
+    
+    if (!(cs->name= (char*)my_once_alloc(length=(uint)strlen(buf)+1,myflags)))
     {
       my_fclose(fb.f,myflags);
       return TRUE;
     }
     memcpy((char*)cs->name,buf,length);
     cs->number=csnum;
+    all_charsets[csnum]=cs;
   }
   my_fclose(fb.f,myflags);
 
@@ -156,7 +163,7 @@ static my_bool init_available_charsets(myf myflags)
    */
   if (!charset_initialized)
   {
-    CHARSET_INFO *cs;
+    CHARSET_INFO **cs;
   /*
     To make things thread safe we are not allowing other threads to interfere
     while we may changing the cs_info_table
@@ -164,13 +171,13 @@ static my_bool init_available_charsets(myf myflags)
     pthread_mutex_lock(&THR_LOCK_charset);
 
     bzero(&all_charsets,sizeof(all_charsets));
+    init_compiled_charsets(myflags);
     
     /* Copy compiled charsets */
-    
-    for (cs=compiled_charsets; cs->name; cs++)
+    for (cs=all_charsets; cs < all_charsets+255 ; cs++)
     {
-      all_charsets[cs->number]=cs[0];
-      set_max_sort_char(&all_charsets[cs->number]);
+      if (*cs)
+        set_max_sort_char(*cs);
     }
     error = read_charset_index(myflags);
     charset_initialized=1;
@@ -339,19 +346,16 @@ static my_bool read_charset_file(const char *cs_name, CHARSET_INFO *set,
 }
 
 
-static CHARSET_INFO *add_charset(uint cs_number, myf flags)
+static CHARSET_INFO *add_charset(CHARSET_INFO *cs, myf flags)
 {
-  CHARSET_INFO *cs;
   uchar  tmp_ctype[CTYPE_TABLE_SIZE];
   uchar  tmp_to_lower[TO_LOWER_TABLE_SIZE];
   uchar  tmp_to_upper[TO_UPPER_TABLE_SIZE];
   uchar  tmp_sort_order[SORT_ORDER_TABLE_SIZE];
   uint16 tmp_to_uni[TO_UNI_TABLE_SIZE];
 
-  /* Note: cs->name is already initialized */
+  /* Note: cs->name and cs->number are already initialized */
   
-  cs=&all_charsets[cs_number];
-
   cs->ctype=tmp_ctype;
   cs->to_lower=tmp_to_lower;
   cs->to_upper=tmp_to_upper;
@@ -365,7 +369,6 @@ static CHARSET_INFO *add_charset(uint cs_number, myf flags)
   cs->to_upper = (uchar*) my_once_alloc(TO_UPPER_TABLE_SIZE,   MYF(MY_WME));
   cs->sort_order=(uchar*) my_once_alloc(SORT_ORDER_TABLE_SIZE, MYF(MY_WME));
   cs->tab_to_uni=(uint16*)my_once_alloc(TO_UNI_TABLE_SIZE*sizeof(uint16), MYF(MY_WME));
-  cs->number   = cs_number;
   memcpy((char*) cs->ctype,	 (char*) tmp_ctype,	sizeof(tmp_ctype));
   memcpy((char*) cs->to_lower, (char*) tmp_to_lower,	sizeof(tmp_to_lower));
   memcpy((char*) cs->to_upper, (char*) tmp_to_upper,	sizeof(tmp_to_upper));
@@ -393,13 +396,13 @@ static CHARSET_INFO *add_charset(uint cs_number, myf flags)
 
 uint get_charset_number(const char *charset_name)
 {
-  CHARSET_INFO *cs;
+  CHARSET_INFO **cs;
   if (init_available_charsets(MYF(0)))	/* If it isn't initialized */
     return 0;
   
   for (cs = all_charsets; cs < all_charsets+255; ++cs)
-    if ( cs->name && !strcmp(cs->name, charset_name))
-      return cs->number;
+    if ( cs[0] && cs[0]->name && !strcmp(cs[0]->name, charset_name))
+      return cs[0]->number;
   
   return 0;   /* this mimics find_type() */
 }
@@ -411,8 +414,8 @@ const char *get_charset_name(uint charset_number)
   if (init_available_charsets(MYF(0)))	/* If it isn't initialized */
     return "?";
 
-  cs=&all_charsets[charset_number];
-  if ( (cs->number==charset_number) && cs->name )
+  cs=all_charsets[charset_number];
+  if ( cs && (cs->number==charset_number) && cs->name )
     return (char*) cs->name;
   
   return (char*) "?";   /* this mimics find_type() */
@@ -428,9 +431,9 @@ static CHARSET_INFO *get_internal_charset(uint cs_number, myf flags)
   */
   pthread_mutex_lock(&THR_LOCK_charset);
 
-  cs = &all_charsets[cs_number];
-  if (!(cs->state & (MY_CS_COMPILED | MY_CS_LOADED)))
-    cs=add_charset(cs_number, flags);
+  cs = all_charsets[cs_number];
+  if (cs && !(cs->state & (MY_CS_COMPILED | MY_CS_LOADED)))
+    cs=add_charset(cs, flags);
 
   pthread_mutex_unlock(&THR_LOCK_charset);
   return cs;
@@ -552,38 +555,41 @@ char * list_charsets(myf want_flags)
 
   if (want_flags & MY_CS_COMPILED)
   {
-    CHARSET_INFO *cs;
-    for (cs = compiled_charsets; cs->number > 0; cs++)
+    CHARSET_INFO **cs;
+    for (cs = all_charsets; cs < all_charsets+255; cs++)
     {
-      dynstr_append(&s, cs->name);
-      dynstr_append(&s, " ");
+      if (cs[0])
+      {
+        dynstr_append(&s, cs[0]->name);
+        dynstr_append(&s, " ");
+      }
     }
   }
 
   if (want_flags & MY_CS_CONFIG)
   {
-    CHARSET_INFO *cs;
+    CHARSET_INFO **cs;
     char buf[FN_REFLEN];
     MY_STAT status;
 
     for (cs=all_charsets; cs < all_charsets+255; cs++)
     {
-      if (!cs->name || charset_in_string(cs->name, &s))
+      if (!cs[0] || !cs[0]->name || charset_in_string(cs[0]->name, &s))
 	continue;
-      get_charset_conf_name(cs->name, buf);
+      get_charset_conf_name(cs[0]->name, buf);
       if (!my_stat(buf, &status, MYF(0)))
 	continue;       /* conf file doesn't exist */
-      dynstr_append(&s, cs->name);
+      dynstr_append(&s, cs[0]->name);
       dynstr_append(&s, " ");
     }
   }
 
   if (want_flags & (MY_CS_INDEX|MY_CS_LOADED))
   {
-    CHARSET_INFO *cs;
+    CHARSET_INFO **cs;
     for (cs = all_charsets; cs < all_charsets + 255; cs++)
-      if (cs->name && (cs->state & want_flags) )
-        charset_append(&s, cs->name);
+      if (cs[0] && cs[0]->name && (cs[0]->state & want_flags) )
+        charset_append(&s, cs[0]->name);
   }
   
   if (s.length)
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 827067c27d7..214cd321562 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -1403,7 +1403,7 @@ int mysqld_show_charsets(THD *thd, const char *wild)
   String packet2(buff,sizeof(buff),default_charset_info);
   List<Item> field_list;
   CONVERT *convert=thd->variables.convert_set;
-  CHARSET_INFO *cs;
+  CHARSET_INFO **cs;
   DBUG_ENTER("mysqld_show_charsets");
 
   field_list.push_back(new Item_empty_string("Name",30));
@@ -1416,16 +1416,16 @@ int mysqld_show_charsets(THD *thd, const char *wild)
 
   for (cs=all_charsets ; cs < all_charsets+255 ; cs++ )
   {
-    if (!cs->name)
+    if (!cs[0])
       continue;
     if (!(wild && wild[0] &&
-	  wild_case_compare(system_charset_info,cs->name,wild)))
+	  wild_case_compare(system_charset_info,cs[0]->name,wild)))
     {
       packet2.length(0);
-      net_store_data(&packet2,convert,cs->name);
-      net_store_data(&packet2,(uint32) cs->number);
-      net_store_data(&packet2,(uint32) cs->strxfrm_multiply);
-      net_store_data(&packet2,(uint32) cs->mbmaxlen ? cs->mbmaxlen : 1);
+      net_store_data(&packet2,convert,cs[0]->name);
+      net_store_data(&packet2,(uint32) cs[0]->number);
+      net_store_data(&packet2,(uint32) cs[0]->strxfrm_multiply);
+      net_store_data(&packet2,(uint32) cs[0]->mbmaxlen ? cs[0]->mbmaxlen : 1);
 
       if (my_net_write(&thd->net, (char*) packet2.ptr(),packet2.length()))
          goto err;
diff --git a/strings/ctype-big5.c b/strings/ctype-big5.c
index 36a2641d2ab..f83cf0cffeb 100644
--- a/strings/ctype-big5.c
+++ b/strings/ctype-big5.c
@@ -48,7 +48,7 @@
 #define big5head(e)	((uchar)(e>>8))
 #define big5tail(e)	((uchar)(e&0xff))
 
-uchar NEAR ctype_big5[257] =
+static uchar NEAR ctype_big5[257] =
 {
   0,				/* For standard library */
   32,32,32,32,32,32,32,32,32,40,40,40,40,40,32,32,
@@ -69,7 +69,7 @@ uchar NEAR ctype_big5[257] =
   0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
 };
 
-uchar NEAR to_lower_big5[]=
+static uchar NEAR to_lower_big5[]=
 {
   '\000','\001','\002','\003','\004','\005','\006','\007',
   '\010','\011','\012','\013','\014','\015','\016','\017',
@@ -105,7 +105,7 @@ uchar NEAR to_lower_big5[]=
   (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377',
 };
 
-uchar NEAR to_upper_big5[]=
+static uchar NEAR to_upper_big5[]=
 {
   '\000','\001','\002','\003','\004','\005','\006','\007',
   '\010','\011','\012','\013','\014','\015','\016','\017',
@@ -141,7 +141,7 @@ uchar NEAR to_upper_big5[]=
   (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377',
 };
 
-uchar NEAR sort_order_big5[]=
+static uchar NEAR sort_order_big5[]=
 {
   '\000','\001','\002','\003','\004','\005','\006','\007',
   '\010','\011','\012','\013','\014','\015','\016','\017',
@@ -218,7 +218,7 @@ static uint16 big5strokexfrm(uint16 i)
   return 0xA140;
 }
 
-int my_strnncoll_big5(CHARSET_INFO *cs __attribute__((unused)), 
+static int my_strnncoll_big5(CHARSET_INFO *cs __attribute__((unused)), 
                       const uchar * s1, uint len1, 
                       const uchar * s2, uint len2)
 {
@@ -242,7 +242,7 @@ int my_strnncoll_big5(CHARSET_INFO *cs __attribute__((unused)),
   return (int) (len1-len2);
 }
 
-int my_strnxfrm_big5(CHARSET_INFO *cs __attribute__((unused)),
+static int my_strnxfrm_big5(CHARSET_INFO *cs __attribute__((unused)),
                      uchar * dest, uint len, 
                      const uchar * src, uint srclen)
 {
@@ -264,7 +264,8 @@ int my_strnxfrm_big5(CHARSET_INFO *cs __attribute__((unused)),
   return srclen;
 }
 
-int my_strcoll_big5(const uchar * s1, const uchar * s2)
+#if 0
+static int my_strcoll_big5(const uchar * s1, const uchar * s2)
 {
 
   while (*s1 && *s2)
@@ -283,7 +284,7 @@ int my_strcoll_big5(const uchar * s1, const uchar * s2)
   return 0;
 }
 
-int my_strxfrm_big5(uchar * dest, const uchar * src, int len)
+static int my_strxfrm_big5(uchar * dest, const uchar * src, int len)
 {
   uint16 e;
   uchar *d = dest;
@@ -309,6 +310,8 @@ int my_strxfrm_big5(uchar * dest, const uchar * src, int len)
   *d = '\0';
   return (int) (d-dest);
 }
+#endif
+
 
 /*
 ** Calculate min_str and max_str that ranges a LIKE string.
@@ -331,7 +334,7 @@ int my_strxfrm_big5(uchar * dest, const uchar * src, int len)
 #define wild_one '_'
 #define wild_many '%'
 
-my_bool my_like_range_big5(CHARSET_INFO *cs __attribute__((unused)),
+static my_bool my_like_range_big5(CHARSET_INFO *cs __attribute__((unused)),
 		           const char *ptr,uint ptr_length,pchar escape,
 		           uint res_length, char *min_str,char *max_str,
 		           uint *min_length,uint *max_length)
@@ -381,18 +384,18 @@ my_bool my_like_range_big5(CHARSET_INFO *cs __attribute__((unused)),
   return 0;
 }
 
-int ismbchar_big5(CHARSET_INFO *cs __attribute__((unused)),
+static int ismbchar_big5(CHARSET_INFO *cs __attribute__((unused)),
                   const char* p, const char *e)
 {
   return (isbig5head(*(p)) && (e)-(p)>1 && isbig5tail(*((p)+1))? 2: 0);
 }
 
-my_bool ismbhead_big5(CHARSET_INFO *cs __attribute__((unused)), uint c)
+static my_bool ismbhead_big5(CHARSET_INFO *cs __attribute__((unused)), uint c)
 {
   return isbig5head(c);
 }
 
-int mbcharlen_big5(CHARSET_INFO *cs __attribute__((unused)), uint c)
+static int mbcharlen_big5(CHARSET_INFO *cs __attribute__((unused)), uint c)
 {
   return (isbig5head(c)? 2: 0);
 }
@@ -6166,7 +6169,7 @@ static int func_uni_big5_onechar(int code){
 }
 
 
-int
+static int
 my_wc_mb_big5(CHARSET_INFO *cs __attribute__((unused)),
 	      my_wc_t wc, unsigned char *s, unsigned char *e)
 {
@@ -6191,7 +6194,7 @@ my_wc_mb_big5(CHARSET_INFO *cs __attribute__((unused)),
   return 2;
 }
 
-int 
+static int 
 my_mb_wc_big5(CHARSET_INFO *cs __attribute__((unused)),
 	      my_wc_t *pwc,const uchar *s,const uchar *e)
 {
@@ -6213,5 +6216,39 @@ my_mb_wc_big5(CHARSET_INFO *cs __attribute__((unused)),
   return 2;
 }
 
+CHARSET_INFO my_charset_big5 =
+{
+    1,			/* number     */
+    MY_CS_COMPILED,	/* state      */
+    "big5",		/* name       */
+    "",			/* comment    */
+    ctype_big5,
+    to_lower_big5,
+    to_upper_big5,
+    sort_order_big5,
+    NULL,		/* tab_to_uni   */
+    NULL,		/* tab_from_uni */
+    1,			/* strxfrm_multiply */
+    my_strnncoll_big5,
+    my_strnxfrm_big5,
+    my_like_range_big5,
+    2,			/* mbmaxlen   */
+    ismbchar_big5,
+    ismbhead_big5,
+    mbcharlen_big5,
+    my_mb_wc_big5,	/* mb_wc       */
+    my_wc_mb_big5,	/* wc_mb       */
+    my_caseup_str_mb,
+    my_casedn_str_mb,
+    my_caseup_mb,
+    my_casedn_mb,
+    NULL,		/* tosort      */
+    my_strcasecmp_mb,
+    my_strncasecmp_mb,
+    NULL,		/* hash_caseup */
+    NULL,		/* hash_sort   */
+    0
+};
+
 
 #endif
diff --git a/strings/ctype-czech.c b/strings/ctype-czech.c
index f3b7777a6d4..3060c29dbac 100644
--- a/strings/ctype-czech.c
+++ b/strings/ctype-czech.c
@@ -233,8 +233,9 @@ static struct wordvalue doubles[] = {
 
 #define IS_END(p, src, len)	(!(*p))
 
+#if 0
 /* Function strcoll, with Czech sorting, for zero terminated strings */
-int my_strcoll_czech(const uchar * s1, const uchar * s2)
+static int my_strcoll_czech(const uchar * s1, const uchar * s2)
 	{
 	int v1, v2;
 	const uchar * p1, * p2, * store1, * store2;
@@ -254,9 +255,11 @@ int my_strcoll_czech(const uchar * s1, const uchar * s2)
 	while (v1);
 	return 0;
 	}
+#endif
 
+#if 0
 /* Function strxfrm, with Czech sorting, for zero terminated strings */
-int my_strxfrm_czech(uchar * dest, const uchar * src, int len)
+static int my_strxfrm_czech(uchar * dest, const uchar * src, int len)
 {
 	int value;
 	const uchar * p, * store;
@@ -272,17 +275,16 @@ int my_strxfrm_czech(uchar * dest, const uchar * src, int len)
 	while (value);
 	return totlen;
 	}
+#endif
+
 
 #undef IS_END
 
-
-
-
 #define IS_END(p, src, len)	(((char *)p - (char *)src) >= (len))
 
 /* Function strnncoll, actually strcoll, with Czech sorting, which expect
    the length of the strings being specified */
-int my_strnncoll_czech(CHARSET_INFO *cs __attribute__((unused)),
+static int my_strnncoll_czech(CHARSET_INFO *cs __attribute__((unused)),
                        const uchar * s1, uint len1, 
                        const uchar * s2, uint len2)
 	{
@@ -308,7 +310,7 @@ int my_strnncoll_czech(CHARSET_INFO *cs __attribute__((unused)),
 
 /* Function strnxfrm, actually strxfrm, with Czech sorting, which expect
    the length of the strings being specified */
-int my_strnxfrm_czech(CHARSET_INFO *cs __attribute__((unused)), 
+static int my_strnxfrm_czech(CHARSET_INFO *cs __attribute__((unused)), 
                       uchar * dest, uint len,
                       const uchar * src, uint srclen)
 	{
@@ -378,7 +380,7 @@ int my_strnxfrm_czech(CHARSET_INFO *cs __attribute__((unused)),
 
 #define EXAMPLE
 
-my_bool my_like_range_czech(CHARSET_INFO *cs __attribute__((unused)),
+static my_bool my_like_range_czech(CHARSET_INFO *cs __attribute__((unused)),
                             const char *ptr,uint ptr_length,pchar escape,
 		            uint res_length, char *min_str,char *max_str,
 		            uint *min_length,uint *max_length)
@@ -437,7 +439,7 @@ my_bool my_like_range_czech(CHARSET_INFO *cs __attribute__((unused)),
 #include <my_global.h>
 #include "m_string.h"
 
-uchar NEAR ctype_czech[257] = {
+static uchar NEAR ctype_czech[257] = {
 0,
  32, 32, 32, 32, 32, 32, 32, 32, 32, 40, 40, 40, 40, 40, 32, 32,
  32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
@@ -457,7 +459,7 @@ uchar NEAR ctype_czech[257] = {
   2,  2,  2,  2,  2,  2,  2, 16,  2,  2,  2,  2,  2,  2,  2, 16,
 };
 
-uchar NEAR to_lower_czech[] = {
+static uchar NEAR to_lower_czech[] = {
   0,  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,
@@ -476,7 +478,7 @@ uchar NEAR to_lower_czech[] = {
 240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,
 };
 
-uchar NEAR to_upper_czech[] = {
+static uchar NEAR to_upper_czech[] = {
   0,  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,
@@ -495,7 +497,7 @@ uchar NEAR to_upper_czech[] = {
 240,209,210,211,212,213,214,247,216,217,218,219,220,221,222,255,
 };
 
-uchar NEAR sort_order_czech[] = {
+static uchar NEAR sort_order_czech[] = {
   0,  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,
@@ -514,6 +516,118 @@ uchar NEAR sort_order_czech[] = {
 255, 98, 99,101,102,103,104,255,109,119,118,120,121,126,116,255,
 };
 
+static uint16 tab_8859_2_uni[256]={
+     0,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,
+0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F,
+0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,
+0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F,
+0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,
+0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F,
+0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,
+0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F,
+0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,
+0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F,
+0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,
+0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F,
+0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,
+0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F,
+0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,
+0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,     0,
+     0,     0,     0,     0,     0,     0,     0,     0,
+     0,     0,     0,     0,     0,     0,     0,     0,
+     0,     0,     0,     0,     0,     0,     0,     0,
+     0,     0,     0,     0,     0,     0,     0,     0,
+0x00A0,0x0104,0x02D8,0x0141,0x00A4,0x013D,0x015A,0x00A7,
+0x00A8,0x0160,0x015E,0x0164,0x0179,0x00AD,0x017D,0x017B,
+0x00B0,0x0105,0x02DB,0x0142,0x00B4,0x013E,0x015B,0x02C7,
+0x00B8,0x0161,0x015F,0x0165,0x017A,0x02DD,0x017E,0x017C,
+0x0154,0x00C1,0x00C2,0x0102,0x00C4,0x0139,0x0106,0x00C7,
+0x010C,0x00C9,0x0118,0x00CB,0x011A,0x00CD,0x00CE,0x010E,
+0x0110,0x0143,0x0147,0x00D3,0x00D4,0x0150,0x00D6,0x00D7,
+0x0158,0x016E,0x00DA,0x0170,0x00DC,0x00DD,0x0162,0x00DF,
+0x0155,0x00E1,0x00E2,0x0103,0x00E4,0x013A,0x0107,0x00E7,
+0x010D,0x00E9,0x0119,0x00EB,0x011B,0x00ED,0x00EE,0x010F,
+0x0111,0x0144,0x0148,0x00F3,0x00F4,0x0151,0x00F6,0x00F7,
+0x0159,0x016F,0x00FA,0x0171,0x00FC,0x00FD,0x0163,0x02D9
+};
+
+
+/* 0000-00FD , 254 chars */
+static uchar tab_uni_8859_2_plane00[]={
+0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,
+0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F,
+0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F,
+0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F,
+0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F,
+0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F,
+0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F,
+0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0xA0,0x00,0x00,0x00,0xA4,0x00,0x00,0xA7,0xA8,0x00,0x00,0x00,0x00,0xAD,0x00,0x00,
+0xB0,0x00,0x00,0x00,0xB4,0x00,0x00,0x00,0xB8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0xC1,0xC2,0x00,0xC4,0x00,0x00,0xC7,0x00,0xC9,0x00,0xCB,0x00,0xCD,0xCE,0x00,
+0x00,0x00,0x00,0xD3,0xD4,0x00,0xD6,0xD7,0x00,0x00,0xDA,0x00,0xDC,0xDD,0x00,0xDF,
+0x00,0xE1,0xE2,0x00,0xE4,0x00,0x00,0xE7,0x00,0xE9,0x00,0xEB,0x00,0xED,0xEE,0x00,
+0x00,0x00,0x00,0xF3,0xF4,0x00,0xF6,0xF7,0x00,0x00,0xFA,0x00,0xFC,0xFD};
+
+/* 0102-017E , 125 chars */
+static uchar tab_uni_8859_2_plane01[]={
+0xC3,0xE3,0xA1,0xB1,0xC6,0xE6,0x00,0x00,0x00,0x00,0xC8,0xE8,0xCF,0xEF,0xD0,0xF0,
+0x00,0x00,0x00,0x00,0x00,0x00,0xCA,0xEA,0xCC,0xEC,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC5,0xE5,0x00,0x00,0xA5,0xB5,0x00,0x00,0xA3,
+0xB3,0xD1,0xF1,0x00,0x00,0xD2,0xF2,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xD5,0xF5,
+0x00,0x00,0xC0,0xE0,0x00,0x00,0xD8,0xF8,0xA6,0xB6,0x00,0x00,0xAA,0xBA,0xA9,0xB9,
+0xDE,0xFE,0xAB,0xBB,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xD9,0xF9,0xDB,0xFB,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xAC,0xBC,0xAF,0xBF,0xAE,0xBE};
+
+/* 02C7-02DD ,  23 chars */
+static uchar tab_uni_8859_2_plane02[]={
+0xB7,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0xA2,0xFF,0x00,0xB2,0x00,0xBD};
+
+static MY_UNI_IDX idx_uni_8859_2[]={
+  {0x0000,0x00FD,tab_uni_8859_2_plane00},
+  {0x0102,0x017E,tab_uni_8859_2_plane01},
+  {0x02C7,0x02DD,tab_uni_8859_2_plane02},
+  {0,0,NULL}
+};
+
+CHARSET_INFO my_charset_czech =
+{
+    2,			/* number */
+    MY_CS_COMPILED,	/* state      */
+    "czech",		/* name */
+    "",			/* comment    */
+    ctype_czech,
+    to_lower_czech,
+    to_upper_czech,
+    sort_order_czech,
+    tab_8859_2_uni,	/* tab_to_uni   */
+    idx_uni_8859_2,	/* tab_from_uni */
+    4,			/* strxfrm_multiply */
+    my_strnncoll_czech,
+    my_strnxfrm_czech,
+    my_like_range_czech,
+    0,			/* mbmaxlen  */
+    NULL,		/* ismbchar  */
+    NULL,		/* ismbhead  */
+    NULL,		/* mbcharlen */
+    my_mb_wc_8bit,	/* mb_wc   */
+    my_wc_mb_8bit,	/* wc_mb   */
+    my_caseup_str_8bit,
+    my_casedn_str_8bit,
+    my_caseup_8bit,
+    my_casedn_8bit,
+    NULL,		/* tosort      */
+    my_strcasecmp_8bit,
+    my_strncasecmp_8bit,
+    NULL,		/* hash_caseup */
+    NULL,		/* hash_sort   */
+    0
+};
+
 #endif
 
 #endif
diff --git a/strings/ctype-euc_kr.c b/strings/ctype-euc_kr.c
index 736a06f8139..5f5129921b9 100644
--- a/strings/ctype-euc_kr.c
+++ b/strings/ctype-euc_kr.c
@@ -33,7 +33,7 @@
 #ifdef HAVE_CHARSET_euc_kr
 
 
-uchar NEAR ctype_euc_kr[257] =
+static uchar NEAR ctype_euc_kr[257] =
 {
     0,				/* For standard library */
     0040, 0040, 0040, 0040, 0040, 0040, 0040, 0040,	/* NUL ^A - ^G */
@@ -70,7 +70,7 @@ uchar NEAR ctype_euc_kr[257] =
     0020, 0020, 0020, 0020, 0020, 0020, 0020, 0000,
 };
 
-uchar NEAR to_lower_euc_kr[]=
+static uchar NEAR to_lower_euc_kr[]=
 {
   '\000','\001','\002','\003','\004','\005','\006','\007',
   '\010','\011','\012','\013','\014','\015','\016','\017',
@@ -106,7 +106,7 @@ uchar NEAR to_lower_euc_kr[]=
   (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377',
 };
 
-uchar NEAR to_upper_euc_kr[]=
+static uchar NEAR to_upper_euc_kr[]=
 {
   '\000','\001','\002','\003','\004','\005','\006','\007',
   '\010','\011','\012','\013','\014','\015','\016','\017',
@@ -142,7 +142,7 @@ uchar NEAR to_upper_euc_kr[]=
   (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377',
 };
 
-uchar NEAR sort_order_euc_kr[]=
+static uchar NEAR sort_order_euc_kr[]=
 {
   '\000','\001','\002','\003','\004','\005','\006','\007',
   '\010','\011','\012','\013','\014','\015','\016','\017',
@@ -183,7 +183,7 @@ uchar NEAR sort_order_euc_kr[]=
 #define iseuc_kr(c)     ((0xa1<=(uchar)(c) && (uchar)(c)<=0xfe))
 
 
-int ismbchar_euc_kr(CHARSET_INFO *cs __attribute__((unused)),
+static int ismbchar_euc_kr(CHARSET_INFO *cs __attribute__((unused)),
 		    const char* p, const char *e)
 {
   return ((*(uchar*)(p)<0x80)? 0:\
@@ -191,12 +191,12 @@ int ismbchar_euc_kr(CHARSET_INFO *cs __attribute__((unused)),
           0);
 }
 
-my_bool ismbhead_euc_kr(CHARSET_INFO *cs __attribute__((unused)),uint c)
+static my_bool ismbhead_euc_kr(CHARSET_INFO *cs __attribute__((unused)),uint c)
 {
   return (iseuc_kr(c));
 }
 
-int mbcharlen_euc_kr(CHARSET_INFO *cs __attribute__((unused)),uint c)
+static int mbcharlen_euc_kr(CHARSET_INFO *cs __attribute__((unused)),uint c)
 {
   return (iseuc_kr(c) ? 2 : 0);
 }
@@ -8587,7 +8587,7 @@ static int func_uni_ksc5601_onechar(int code){
 }
 
 
-int
+static int
 my_wc_mb_euc_kr(CHARSET_INFO *cs __attribute__((unused)),
 		 my_wc_t wc, uchar *s, uchar *e)
 {
@@ -8611,7 +8611,7 @@ my_wc_mb_euc_kr(CHARSET_INFO *cs __attribute__((unused)),
   return 2;
 }
 
-int 
+static int 
 my_mb_wc_euc_kr(CHARSET_INFO *cs __attribute__((unused)),
 		 my_wc_t *pwc, const uchar *s, const uchar *e)
 {
@@ -8633,5 +8633,38 @@ my_mb_wc_euc_kr(CHARSET_INFO *cs __attribute__((unused)),
   return 2;
 }
 
+CHARSET_INFO my_charset_euc_kr =
+{
+    19,			/* number */
+    MY_CS_COMPILED,	/* state      */
+    "euc_kr",		/* name */
+    "",			/* comment    */
+    ctype_euc_kr,
+    to_lower_euc_kr,
+    to_upper_euc_kr,
+    sort_order_euc_kr,
+    NULL,		/* tab_to_uni   */
+    NULL,		/* tab_from_uni */
+    0,			/* strxfrm_multiply */
+    my_strnncoll_simple,/* strnncoll  */
+    NULL,		/* strnxfrm   */
+    NULL,		/* like_range */
+    2,			/* mbmaxlen */
+    ismbchar_euc_kr,
+    ismbhead_euc_kr,
+    mbcharlen_euc_kr,
+    my_mb_wc_euc_kr,	/* mb_wc   */
+    my_wc_mb_euc_kr,	/* wc_mb   */
+    my_caseup_str_mb,
+    my_casedn_str_mb,
+    my_caseup_mb,
+    my_casedn_mb,
+    my_tosort_8bit,
+    my_strcasecmp_mb,
+    my_strncasecmp_mb,
+    NULL,		/* hash_caseup */
+    NULL,		/* hash_sort   */
+    0
+};
 
 #endif
diff --git a/strings/ctype-gb2312.c b/strings/ctype-gb2312.c
index 7da86915fbd..9823eceee5b 100644
--- a/strings/ctype-gb2312.c
+++ b/strings/ctype-gb2312.c
@@ -30,7 +30,7 @@
 
 #ifdef HAVE_CHARSET_gb2312
 
-uchar NEAR ctype_gb2312[257] =
+static uchar NEAR ctype_gb2312[257] =
 {
   0,				/* For standard library */
   32,32,32,32,32,32,32,32,32,40,40,40,40,40,32,32,
@@ -51,7 +51,7 @@ uchar NEAR ctype_gb2312[257] =
   3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,
 };
 
-uchar NEAR to_lower_gb2312[]=
+static uchar NEAR to_lower_gb2312[]=
 {
   '\000','\001','\002','\003','\004','\005','\006','\007',
   '\010','\011','\012','\013','\014','\015','\016','\017',
@@ -87,7 +87,7 @@ uchar NEAR to_lower_gb2312[]=
   (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377',
 };
 
-uchar NEAR to_upper_gb2312[]=
+static uchar NEAR to_upper_gb2312[]=
 {
   '\000','\001','\002','\003','\004','\005','\006','\007',
   '\010','\011','\012','\013','\014','\015','\016','\017',
@@ -123,7 +123,7 @@ uchar NEAR to_upper_gb2312[]=
   (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377',
 };
 
-uchar NEAR sort_order_gb2312[]=
+static uchar NEAR sort_order_gb2312[]=
 {
   '\000','\001','\002','\003','\004','\005','\006','\007',
   '\010','\011','\012','\013','\014','\015','\016','\017',
@@ -166,18 +166,18 @@ uchar NEAR sort_order_gb2312[]=
 #define isgb2312tail(c) (0xa1<=(uchar)(c) && (uchar)(c)<=0xfe)
 
 
-int ismbchar_gb2312(CHARSET_INFO *cs __attribute__((unused)),
+static int ismbchar_gb2312(CHARSET_INFO *cs __attribute__((unused)),
 		    const char* p, const char *e)
 {
   return (isgb2312head(*(p)) && (e)-(p)>1 && isgb2312tail(*((p)+1))? 2: 0);
 }
 
-my_bool ismbhead_gb2312(CHARSET_INFO *cs __attribute__((unused)),uint c)
+static my_bool ismbhead_gb2312(CHARSET_INFO *cs __attribute__((unused)),uint c)
 {
   return isgb2312head(c);
 }
 
-int mbcharlen_gb2312(CHARSET_INFO *cs __attribute__((unused)),uint c)
+static int mbcharlen_gb2312(CHARSET_INFO *cs __attribute__((unused)),uint c)
 {
   return (isgb2312head(c)? 2:0);
 }
@@ -5637,7 +5637,7 @@ static int func_uni_gb2312_onechar(int code){
 }
 
 
-int
+static int
 my_wc_mb_gb2312(CHARSET_INFO *cs  __attribute__((unused)),
 		my_wc_t wc, uchar *s, uchar *e)
 {
@@ -5661,7 +5661,7 @@ my_wc_mb_gb2312(CHARSET_INFO *cs  __attribute__((unused)),
   return 2;
 }
 
-int 
+static int 
 my_mb_wc_gb2312(CHARSET_INFO *cs  __attribute__((unused)),
 		my_wc_t *pwc, const uchar *s, const uchar *e){
   int hi;
@@ -5683,5 +5683,38 @@ my_mb_wc_gb2312(CHARSET_INFO *cs  __attribute__((unused)),
   return 2;
 }
 
+CHARSET_INFO my_charset_gb2312 =
+{
+    24,			/* number */
+    MY_CS_COMPILED,	/* state      */
+    "gb2312",		/* name */
+    "",			/* comment    */
+    ctype_gb2312,
+    to_lower_gb2312,
+    to_upper_gb2312,
+    sort_order_gb2312,
+    NULL,		/* tab_to_uni   */
+    NULL,		/* tab_from_uni */
+    0,			/* strxfrm_multiply */
+    my_strnncoll_simple,/* strnncoll  */
+    NULL,		/* strnxfrm   */
+    NULL,		/* like_range */
+    2,			/* mbmaxlen */
+    ismbchar_gb2312,
+    ismbhead_gb2312,
+    mbcharlen_gb2312,
+    my_mb_wc_gb2312,	/* mb_wc      */
+    my_wc_mb_gb2312,	/* wc_mb      */
+    my_caseup_str_mb,
+    my_casedn_str_mb,
+    my_caseup_mb,
+    my_casedn_mb,
+    my_tosort_8bit,
+    my_strcasecmp_mb,
+    my_strncasecmp_mb,
+    NULL,		/* hash_caseup */
+    NULL,		/* hash_sort   */
+    0
+};
 
 #endif
diff --git a/strings/ctype-gbk.c b/strings/ctype-gbk.c
index 79e74b5f434..fd70dac2123 100644
--- a/strings/ctype-gbk.c
+++ b/strings/ctype-gbk.c
@@ -45,7 +45,7 @@
 #define gbkhead(e)     ((uchar)(e>>8))
 #define gbktail(e)     ((uchar)(e&0xff))
 
-uchar NEAR ctype_gbk[257] =
+static uchar NEAR ctype_gbk[257] =
 {
   0,				/* For standard library */
   32,32,32,32,32,32,32,32,32,40,40,40,40,40,32,32,
@@ -66,7 +66,7 @@ uchar NEAR ctype_gbk[257] =
   3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,
 };
 
-uchar NEAR to_lower_gbk[]=
+static uchar NEAR to_lower_gbk[]=
 {
   '\000','\001','\002','\003','\004','\005','\006','\007',
   '\010','\011','\012','\013','\014','\015','\016','\017',
@@ -102,7 +102,7 @@ uchar NEAR to_lower_gbk[]=
   (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377',
 };
 
-uchar NEAR to_upper_gbk[]=
+static uchar NEAR to_upper_gbk[]=
 {
   '\000','\001','\002','\003','\004','\005','\006','\007',
   '\010','\011','\012','\013','\014','\015','\016','\017',
@@ -138,7 +138,7 @@ uchar NEAR to_upper_gbk[]=
   (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377',
 };
 
-uchar NEAR sort_order_gbk[]=
+static uchar NEAR sort_order_gbk[]=
 {
   '\000','\001','\002','\003','\004','\005','\006','\007',
   '\010','\011','\012','\013','\014','\015','\016','\017',
@@ -9824,7 +9824,7 @@ static int func_uni_gbk_onechar(int code){
   return(0);
 }
 
-int
+static int
 my_wc_mb_gbk(CHARSET_INFO *cs  __attribute__((unused)),
 	      my_wc_t wc, uchar *s, uchar *e)
 {
@@ -9847,7 +9847,7 @@ my_wc_mb_gbk(CHARSET_INFO *cs  __attribute__((unused)),
   return 2;
 }
 
-int
+static int
 my_mb_wc_gbk(CHARSET_INFO *cs __attribute__((unused)),
 	      my_wc_t *pwc, const uchar *s, const uchar *e)
 {
@@ -9871,4 +9871,39 @@ my_mb_wc_gbk(CHARSET_INFO *cs __attribute__((unused)),
   
 }
 
+CHARSET_INFO my_charset_gbk =
+{
+    28,			/* number */
+    MY_CS_COMPILED,	/* state      */
+    "gbk",		/* name */
+    "",			/* comment    */
+    ctype_gbk,
+    to_lower_gbk,
+    to_upper_gbk,
+    sort_order_gbk,
+    NULL,		/* tab_to_uni   */
+    NULL,		/* tab_from_uni */
+    1,			/* strxfrm_multiply */
+    my_strnncoll_gbk,
+    my_strnxfrm_gbk,
+    my_like_range_gbk,
+    2,			/* mbmaxlen */
+    ismbchar_gbk,
+    ismbhead_gbk,
+    mbcharlen_gbk,
+    my_mb_wc_gbk,	/* mb_wc      */
+    my_wc_mb_gbk,	/* wc_mb      */
+    my_caseup_str_mb,
+    my_casedn_str_mb,
+    my_caseup_mb,
+    my_casedn_mb,
+    NULL,		/* tosort      */
+    my_strcasecmp_mb,
+    my_strncasecmp_mb,
+    NULL,		/* hash_caseup */
+    NULL,		/* hash_sort   */
+    0
+};
+
+
 #endif
diff --git a/strings/ctype-latin1_de.c b/strings/ctype-latin1_de.c
index 80fb259dfc8..b34b091d679 100644
--- a/strings/ctype-latin1_de.c
+++ b/strings/ctype-latin1_de.c
@@ -38,7 +38,65 @@
 
 #ifdef HAVE_CHARSET_latin1_de
 
-uchar ctype_latin1_de[] = {
+static uint16 tab_8859_1_uni[256]={
+     0,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,
+0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F,
+0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,
+0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F,
+0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,
+0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F,
+0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,
+0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F,
+0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,
+0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F,
+0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,
+0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F,
+0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,
+0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F,
+0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,
+0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,     0,
+     0,     0,     0,     0,     0,     0,     0,     0,
+     0,     0,     0,     0,     0,     0,     0,     0,
+     0,     0,     0,     0,     0,     0,     0,     0,
+     0,     0,     0,     0,     0,     0,     0,     0,
+0x00A0,0x00A1,0x00A2,0x00A3,0x00A4,0x00A5,0x00A6,0x00A7,
+0x00A8,0x00A9,0x00AA,0x00AB,0x00AC,0x00AD,0x00AE,0x00AF,
+0x00B0,0x00B1,0x00B2,0x00B3,0x00B4,0x00B5,0x00B6,0x00B7,
+0x00B8,0x00B9,0x00BA,0x00BB,0x00BC,0x00BD,0x00BE,0x00BF,
+0x00C0,0x00C1,0x00C2,0x00C3,0x00C4,0x00C5,0x00C6,0x00C7,
+0x00C8,0x00C9,0x00CA,0x00CB,0x00CC,0x00CD,0x00CE,0x00CF,
+0x00D0,0x00D1,0x00D2,0x00D3,0x00D4,0x00D5,0x00D6,0x00D7,
+0x00D8,0x00D9,0x00DA,0x00DB,0x00DC,0x00DD,0x00DE,0x00DF,
+0x00E0,0x00E1,0x00E2,0x00E3,0x00E4,0x00E5,0x00E6,0x00E7,
+0x00E8,0x00E9,0x00EA,0x00EB,0x00EC,0x00ED,0x00EE,0x00EF,
+0x00F0,0x00F1,0x00F2,0x00F3,0x00F4,0x00F5,0x00F6,0x00F7,
+0x00F8,0x00F9,0x00FA,0x00FB,0x00FC,0x00FD,0x00FE,0x00FF
+};
+
+static uchar tab_uni_8859_1_plane00[]={
+0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,
+0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F,
+0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F,
+0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F,
+0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F,
+0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F,
+0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F,
+0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,
+0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF,
+0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,
+0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF,
+0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF,
+0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF};
+
+static MY_UNI_IDX idx_uni_8859_1[]={
+  {0x0000,0x00FF,tab_uni_8859_1_plane00},
+  {0,0,NULL}
+};
+
+static uchar ctype_latin1_de[] = {
     0,
    32, 32, 32, 32, 32, 32, 32, 32, 32, 40, 40, 40, 40, 40, 32, 32,
    32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
@@ -58,7 +116,7 @@ uchar ctype_latin1_de[] = {
     2,  2,  2,  2,  2,  2,  2, 16,  2,  2,  2,  2,  2,  2,  2,  2
 };
 
-uchar to_lower_latin1_de[] = {
+static uchar to_lower_latin1_de[] = {
     0,  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,
@@ -77,7 +135,7 @@ uchar to_lower_latin1_de[] = {
   240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255
 };
 
-uchar to_upper_latin1_de[] = {
+static uchar to_upper_latin1_de[] = {
     0,  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,
@@ -104,7 +162,7 @@ uchar to_upper_latin1_de[] = {
  * �, �, �, �, �, �
  */
 
-uchar sort_order_latin1_de[] = {
+static uchar sort_order_latin1_de[] = {
     0,  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,
@@ -164,7 +222,7 @@ uchar sort_order_latin1_de[] = {
   }
 
 
-int my_strnncoll_latin1_de(CHARSET_INFO *cs __attribute__((unused)),
+static int my_strnncoll_latin1_de(CHARSET_INFO *cs __attribute__((unused)),
                            const uchar * s1, uint len1,
                            const uchar * s2, uint len2)
 {
@@ -238,7 +296,7 @@ int my_strnncoll_latin1_de(CHARSET_INFO *cs __attribute__((unused)),
 }
 
 
-int my_strnxfrm_latin1_de(CHARSET_INFO *cs __attribute__((unused)),
+static int my_strnxfrm_latin1_de(CHARSET_INFO *cs __attribute__((unused)),
                           uchar * dest, uint len,
                           const uchar * src, uint srclen)
 {
@@ -303,7 +361,7 @@ int my_strnxfrm_latin1_de(CHARSET_INFO *cs __attribute__((unused)),
 #define wild_one '_'
 #define wild_many '%'
 
-my_bool my_like_range_latin1_de(CHARSET_INFO *cs __attribute__((unused)),
+static my_bool my_like_range_latin1_de(CHARSET_INFO *cs __attribute__((unused)),
 				const char *ptr, uint ptr_length,
 				pchar escape, uint res_length,
 				char *min_str, char *max_str,
@@ -353,4 +411,39 @@ my_bool my_like_range_latin1_de(CHARSET_INFO *cs __attribute__((unused)),
   return 0;
 }
 
+
+CHARSET_INFO my_charset_latin1_de =
+{
+    31,			/* number */
+    MY_CS_COMPILED,	/* state      */
+    "latin1_de",	/* name */
+    "",			/* comment    */
+    ctype_latin1_de,
+    to_lower_latin1_de,
+    to_upper_latin1_de,
+    sort_order_latin1_de,
+    tab_8859_1_uni,	/* tab_to_uni   */
+    idx_uni_8859_1,	/* tab_from_uni */
+    2,			/* strxfrm_multiply */
+    my_strnncoll_latin1_de,
+    my_strnxfrm_latin1_de,
+    my_like_range_latin1_de,
+    0,			/* mbmaxlen  */
+    NULL,		/* ismbchar  */
+    NULL,		/* ismbhead  */
+    NULL,		/* mbcharlen */
+    my_mb_wc_8bit,	/* mb_wc   */
+    my_wc_mb_8bit,	/* wc_mb   */
+    my_caseup_str_8bit,
+    my_casedn_str_8bit,
+    my_caseup_8bit,
+    my_casedn_8bit,
+    NULL,		/* tosort      */
+    my_strcasecmp_8bit,
+    my_strncasecmp_8bit,
+    NULL,		/* hash_caseup */
+    NULL,		/* hash_sort   */
+    0
+};
+
 #endif
diff --git a/strings/ctype-sjis.c b/strings/ctype-sjis.c
index e8c3890abc9..f61d3753536 100644
--- a/strings/ctype-sjis.c
+++ b/strings/ctype-sjis.c
@@ -32,7 +32,7 @@
  * .configure. mbmaxlen_sjis=2
  */
 
-uchar NEAR ctype_sjis[257] =
+static uchar NEAR ctype_sjis[257] =
 {
     0,				/* For standard library */
     0040, 0040, 0040, 0040, 0040, 0040, 0040, 0040,	/* NUL ^A - ^G */
@@ -69,7 +69,7 @@ uchar NEAR ctype_sjis[257] =
     0020, 0020, 0020, 0020, 0020, 0000, 0000, 0000
 };
 
-uchar NEAR to_lower_sjis[]=
+static uchar NEAR to_lower_sjis[]=
 {
   '\000','\001','\002','\003','\004','\005','\006','\007',
   '\010','\011','\012','\013','\014','\015','\016','\017',
@@ -105,7 +105,7 @@ uchar NEAR to_lower_sjis[]=
   (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377'
 };
 
-uchar NEAR to_upper_sjis[]=
+static uchar NEAR to_upper_sjis[]=
 {
   '\000','\001','\002','\003','\004','\005','\006','\007',
   '\010','\011','\012','\013','\014','\015','\016','\017',
@@ -141,7 +141,7 @@ uchar NEAR to_upper_sjis[]=
   (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377'
 };
 
-uchar NEAR sort_order_sjis[]=
+static uchar NEAR sort_order_sjis[]=
 {
   '\000','\001','\002','\003','\004','\005','\006','\007',
   '\010','\011','\012','\013','\014','\015','\016','\017',
@@ -183,18 +183,18 @@ uchar NEAR sort_order_sjis[]=
                        (0x80<=(c) && (c)<=0xfc))
 
 
-int ismbchar_sjis(CHARSET_INFO *cs __attribute__((unused)),
+static int ismbchar_sjis(CHARSET_INFO *cs __attribute__((unused)),
 		  const char* p, const char *e)
 {
   return (issjishead((uchar) *p) && (e-p)>1 && issjistail((uchar)p[1]) ? 2: 0);
 }
 
-my_bool ismbhead_sjis(CHARSET_INFO *cs __attribute__((unused)),uint c)
+static my_bool ismbhead_sjis(CHARSET_INFO *cs __attribute__((unused)),uint c)
 {
   return issjishead((uchar) c);
 }
 
-int mbcharlen_sjis(CHARSET_INFO *cs __attribute__((unused)),uint c)
+static int mbcharlen_sjis(CHARSET_INFO *cs __attribute__((unused)),uint c)
 {
   return (issjishead((uchar) c) ? 2: 0);
 }
@@ -202,7 +202,7 @@ int mbcharlen_sjis(CHARSET_INFO *cs __attribute__((unused)),uint c)
 
 #define sjiscode(c,d)	((((uint) (uchar)(c)) << 8) | (uint) (uchar) (d))
 
-int my_strnncoll_sjis(CHARSET_INFO *cs __attribute__((unused)),
+static int my_strnncoll_sjis(CHARSET_INFO *cs __attribute__((unused)),
                       const uchar *s1, uint len1,
                       const uchar *s2, uint len2)
 {
@@ -227,7 +227,7 @@ int my_strnncoll_sjis(CHARSET_INFO *cs __attribute__((unused)),
   return len1 - len2;
 }
 
-int my_strnxfrm_sjis(CHARSET_INFO *cs __attribute__((unused)),
+static int my_strnxfrm_sjis(CHARSET_INFO *cs __attribute__((unused)),
                      uchar *dest, uint len,
                      const uchar *src, uint srclen)
 {
@@ -266,7 +266,7 @@ int my_strnxfrm_sjis(CHARSET_INFO *cs __attribute__((unused)),
 #define wild_one '_'
 #define wild_many '%'
 
-my_bool my_like_range_sjis(CHARSET_INFO *cs __attribute__((unused)),
+static my_bool my_like_range_sjis(CHARSET_INFO *cs __attribute__((unused)),
                            const char *ptr,uint ptr_length,pchar escape,
                            uint res_length, char *min_str,char *max_str,
                            uint *min_length,uint *max_length)
@@ -4415,7 +4415,7 @@ static int func_uni_sjis_onechar(int code){
 }
 
 
-int
+static int
 my_wc_mb_sjis(CHARSET_INFO *cs  __attribute__((unused)),
 	      my_wc_t wc, uchar *s, uchar *e)
 {
@@ -4438,7 +4438,7 @@ my_wc_mb_sjis(CHARSET_INFO *cs  __attribute__((unused)),
   return 2;
 }
 
-int 
+static int 
 my_mb_wc_sjis(CHARSET_INFO *cs  __attribute__((unused)),
 	      my_wc_t *pwc, const uchar *s, const uchar *e){
   int hi=s[0];
@@ -4458,5 +4458,38 @@ my_mb_wc_sjis(CHARSET_INFO *cs  __attribute__((unused)),
   return 2;
 }
 
+CHARSET_INFO my_charset_sjis =
+{
+    13,			/* number */
+    MY_CS_COMPILED,	/* state      */
+    "sjis",		/* name */
+    "",			/* comment    */
+    ctype_sjis,
+    to_lower_sjis,
+    to_upper_sjis,
+    sort_order_sjis,
+    NULL,		/* tab_to_uni   */
+    NULL,		/* tab_from_uni */
+    1,			/* strxfrm_multiply */
+    my_strnncoll_sjis,
+    my_strnxfrm_sjis,
+    my_like_range_sjis,
+    2,			/* mbmaxlen */
+    ismbchar_sjis,
+    ismbhead_sjis,
+    mbcharlen_sjis,
+    my_mb_wc_sjis,	/* mb_wc */
+    my_wc_mb_sjis,	/* wc_mb */
+    my_caseup_str_8bit,
+    my_casedn_str_8bit,
+    my_caseup_8bit,
+    my_casedn_8bit,
+    NULL,		/* tosort      */
+    my_strcasecmp_8bit,
+    my_strncasecmp_8bit,
+    NULL,		/* hash_caseup */
+    NULL,		/* hash_sort   */
+    0
+};
 
 #endif
diff --git a/strings/ctype-tis620.c b/strings/ctype-tis620.c
index b4358a967ac..1a4be5b3f9a 100644
--- a/strings/ctype-tis620.c
+++ b/strings/ctype-tis620.c
@@ -685,4 +685,40 @@ void ThNormalize(uchar* ptr, uint field_length, const uchar* from, uint length)
   }
 }
 
+
+CHARSET_INFO my_charset_tis620 =
+{
+    18,			/* number */
+    MY_CS_COMPILED,	/* state      */
+    "tis620",		/* name */
+    "",			/* comment    */
+    ctype_tis620,
+    to_lower_tis620,
+    to_upper_tis620,
+    sort_order_tis620,
+    NULL,		/* tab_to_uni   */
+    NULL,		/* tab_from_uni */
+    4,			/* strxfrm_multiply */
+    my_strnncoll_tis620,
+    my_strnxfrm_tis620,
+    my_like_range_tis620,
+    0,			/* mbmaxlen  */
+    NULL,		/* ismbchar  */
+    NULL,		/* ismbhead  */
+    NULL,		/* mbcharlen */
+    my_mb_wc_8bit,	/* mb_wc   */
+    my_wc_mb_8bit,	/* wc_mb   */
+    my_caseup_str_8bit,
+    my_casedn_str_8bit,
+    my_caseup_8bit,
+    my_casedn_8bit,
+    NULL,		/* tosort      */
+    my_strcasecmp_8bit,
+    my_strncasecmp_8bit,
+    NULL,		/* hash_caseup */
+    NULL,		/* hash_sort   */
+    0
+};
+
+
 #endif
diff --git a/strings/ctype-ujis.c b/strings/ctype-ujis.c
index d8de08fb117..086e3362f8b 100644
--- a/strings/ctype-ujis.c
+++ b/strings/ctype-ujis.c
@@ -32,7 +32,7 @@
 #ifdef HAVE_CHARSET_ujis
 
 
-uchar NEAR ctype_ujis[257] =
+static uchar NEAR ctype_ujis[257] =
 {
     0,				/* For standard library */
     0040, 0040, 0040, 0040, 0040, 0040, 0040, 0040,	/* NUL ^A - ^G */
@@ -69,7 +69,7 @@ uchar NEAR ctype_ujis[257] =
     0020, 0020, 0020, 0020, 0020, 0020, 0020, 0000,
 };
 
-uchar NEAR to_lower_ujis[]=
+static uchar NEAR to_lower_ujis[]=
 {
   '\000','\001','\002','\003','\004','\005','\006','\007',
   '\010','\011','\012','\013','\014','\015','\016','\017',
@@ -105,7 +105,7 @@ uchar NEAR to_lower_ujis[]=
   (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377'
 };
 
-uchar NEAR to_upper_ujis[]=
+static uchar NEAR to_upper_ujis[]=
 {
   '\000','\001','\002','\003','\004','\005','\006','\007',
   '\010','\011','\012','\013','\014','\015','\016','\017',
@@ -141,7 +141,7 @@ uchar NEAR to_upper_ujis[]=
   (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377'
 };
 
-uchar NEAR sort_order_ujis[]=
+static uchar NEAR sort_order_ujis[]=
 {
   '\000','\001','\002','\003','\004','\005','\006','\007',
   '\010','\011','\012','\013','\014','\015','\016','\017',
@@ -184,7 +184,7 @@ uchar NEAR sort_order_ujis[]=
 #define isujis_ss3(c) (((c)&0xff) == 0x8f)
 
 
-int ismbchar_ujis(CHARSET_INFO *cs __attribute__((unused)),
+static int ismbchar_ujis(CHARSET_INFO *cs __attribute__((unused)),
 		  const char* p, const char *e)
 {
   return ((*(uchar*)(p)<0x80)? 0:\
@@ -194,12 +194,12 @@ int ismbchar_ujis(CHARSET_INFO *cs __attribute__((unused)),
     0);
 }
 
-my_bool ismbhead_ujis(CHARSET_INFO *cs __attribute__((unused)),uint c)
+static my_bool ismbhead_ujis(CHARSET_INFO *cs __attribute__((unused)),uint c)
 {
   return (isujis(c) || isujis_ss2(c) || isujis_ss3(c));
 }
 
-int mbcharlen_ujis(CHARSET_INFO *cs __attribute__((unused)),uint c)
+static int mbcharlen_ujis(CHARSET_INFO *cs __attribute__((unused)),uint c)
 {
   return (isujis(c)? 2: isujis_ss2(c)? 2: isujis_ss3(c)? 3: 0);
 }
@@ -8257,7 +8257,7 @@ my_jisx0212_uni_onechar(int code){
   [xA1-xFE][xA1-xFE]		# JIS X 0208:1997 (two bytes/char)
 */
 
-int
+static int
 my_mb_wc_euc_jp(CHARSET_INFO *cs,my_wc_t *pwc, const uchar *s, const uchar *e)
 {
   int c1,c2,c3;
@@ -8344,7 +8344,7 @@ my_mb_wc_euc_jp(CHARSET_INFO *cs,my_wc_t *pwc, const uchar *s, const uchar *e)
   return MY_CS_ILSEQ;
 }
 
-int
+static int
 my_wc_mb_euc_jp(CHARSET_INFO *c,my_wc_t wc, unsigned char *s, unsigned char *e)
 {
   unsigned char buf[2];
@@ -8427,5 +8427,39 @@ my_wc_mb_euc_jp(CHARSET_INFO *c,my_wc_t wc, unsigned char *s, unsigned char *e)
   return MY_CS_ILUNI;
 }
 
+CHARSET_INFO my_charset_ujis =
+{
+    12,			/* number       */
+    MY_CS_COMPILED,	/* state      */
+    "ujis",		/* name         */
+    "",			/* comment    */
+    ctype_ujis,
+    to_lower_ujis,
+    to_upper_ujis,
+    sort_order_ujis,
+    NULL,		/* tab_to_uni   */
+    NULL,		/* tab_from_uni */
+    0,			/* strxfrm_multiply */
+    NULL,		/* strnncoll    */
+    NULL,		/* strnxfrm     */
+    NULL,		/* like_range   */
+    3,			/* mbmaxlen     */
+    ismbchar_ujis,
+    ismbhead_ujis,
+    mbcharlen_ujis,
+    my_mb_wc_euc_jp,	 /* mb_wc       */
+    my_wc_mb_euc_jp,	 /* wc_mb       */
+    my_caseup_str_mb,
+    my_casedn_str_mb,
+    my_caseup_mb,
+    my_casedn_mb,
+    my_tosort_8bit,
+    my_strcasecmp_mb,
+    my_strncasecmp_mb,
+    NULL,		/* hash_caseup */
+    NULL,		/* hash_sort   */
+    0
+};
+
 
 #endif
diff --git a/strings/ctype-utf8.c b/strings/ctype-utf8.c
index 1cce8819619..81671e28c3f 100644
--- a/strings/ctype-utf8.c
+++ b/strings/ctype-utf8.c
@@ -1516,7 +1516,7 @@ static MY_UNICASE_INFO *uni_plane[256]={
 
 /* These arrays are taken from usa7 implementation */
 
-uchar ctype_utf8[] = {
+static uchar ctype_utf8[] = {
     0,
    32, 32, 32, 32, 32, 32, 32, 32, 32, 40, 40, 40, 40, 40, 32, 32,
    32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
@@ -1536,7 +1536,7 @@ uchar ctype_utf8[] = {
     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0
 };
 
-uchar to_lower_utf8[] = {
+static uchar to_lower_utf8[] = {
     0,  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,
@@ -1555,7 +1555,7 @@ uchar to_lower_utf8[] = {
   240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255
 };
 
-uchar to_upper_utf8[] = {
+static uchar to_upper_utf8[] = {
     0,  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,
@@ -1575,7 +1575,7 @@ uchar to_upper_utf8[] = {
 };
 
 
-int my_utf8_uni (CHARSET_INFO *cs __attribute__((unused)) , 
+static int my_utf8_uni (CHARSET_INFO *cs __attribute__((unused)) , 
                  my_wc_t * pwc, const uchar *s, const uchar *e)
 {
   unsigned char c = s[0];
@@ -1677,7 +1677,7 @@ int my_utf8_uni (CHARSET_INFO *cs __attribute__((unused)) ,
     return MY_CS_ILSEQ;
 }
 
-int my_uni_utf8 (CHARSET_INFO *cs __attribute__((unused)) ,
+static int my_uni_utf8 (CHARSET_INFO *cs __attribute__((unused)) ,
                  my_wc_t wc, uchar *r, uchar *e)
 {
   int count;
@@ -1720,7 +1720,7 @@ int my_uni_utf8 (CHARSET_INFO *cs __attribute__((unused)) ,
 }
 
 
-void my_caseup_utf8(CHARSET_INFO *cs, char *s, uint slen)
+static void my_caseup_utf8(CHARSET_INFO *cs, char *s, uint slen)
 {
   my_wc_t wc;
   int res;
@@ -1736,7 +1736,7 @@ void my_caseup_utf8(CHARSET_INFO *cs, char *s, uint slen)
   }
 }
 
-uint my_hash_caseup_utf8(CHARSET_INFO *cs, const byte *s, uint slen)
+static uint my_hash_caseup_utf8(CHARSET_INFO *cs, const byte *s, uint slen)
 {
   my_wc_t wc;
   register uint nr=1, nr2=4;
@@ -1759,7 +1759,7 @@ uint my_hash_caseup_utf8(CHARSET_INFO *cs, const byte *s, uint slen)
 }
 
 
-void my_hash_sort_utf8(CHARSET_INFO *cs, const uchar *s, uint slen, ulong *n1, ulong *n2)
+static void my_hash_sort_utf8(CHARSET_INFO *cs, const uchar *s, uint slen, ulong *n1, ulong *n2)
 {
   my_wc_t wc;
   int res;
@@ -1778,13 +1778,13 @@ void my_hash_sort_utf8(CHARSET_INFO *cs, const uchar *s, uint slen, ulong *n1, u
 }
 
 
-void my_caseup_str_utf8(CHARSET_INFO * cs, char * s)
+static void my_caseup_str_utf8(CHARSET_INFO * cs, char * s)
 {
   my_caseup_utf8(cs, s, strlen(s));
 }
 
 
-void my_casedn_utf8(CHARSET_INFO *cs, char *s, uint slen)
+static void my_casedn_utf8(CHARSET_INFO *cs, char *s, uint slen)
 {
   my_wc_t wc;
   int res;
@@ -1802,13 +1802,13 @@ void my_casedn_utf8(CHARSET_INFO *cs, char *s, uint slen)
   }
 }
 
-void my_casedn_str_utf8(CHARSET_INFO *cs, char * s)
+static void my_casedn_str_utf8(CHARSET_INFO *cs, char * s)
 {
   my_casedn_utf8(cs, s, strlen(s));
 }
 
 
-int my_strnncoll_utf8(CHARSET_INFO *cs, 
+static int my_strnncoll_utf8(CHARSET_INFO *cs, 
 		const uchar *s, uint slen, const uchar *t, uint tlen)
 {
   int s_res,t_res;
@@ -1843,7 +1843,7 @@ int my_strnncoll_utf8(CHARSET_INFO *cs,
   return ( (se-s) - (te-t) );
 }
 
-int my_strncasecmp_utf8(CHARSET_INFO *cs,
+static int my_strncasecmp_utf8(CHARSET_INFO *cs,
 		const char *s, const char *t,  uint len)
 {
   int s_res,t_res;
@@ -1879,7 +1879,7 @@ int my_strncasecmp_utf8(CHARSET_INFO *cs,
   return ( (se-s) - (te-t) );
 }
 
-int my_strcasecmp_utf8(CHARSET_INFO *cs, const char *s, const char *t)
+static int my_strcasecmp_utf8(CHARSET_INFO *cs, const char *s, const char *t)
 {
   uint s_len=strlen(s);
   uint t_len=strlen(t);
@@ -1887,8 +1887,9 @@ int my_strcasecmp_utf8(CHARSET_INFO *cs, const char *s, const char *t)
   return  my_strncasecmp_utf8(cs, s, t, len);
 }
 
-int my_strnxfrm_utf8(CHARSET_INFO *cs, 
-	uchar *dst, uint dstlen, const uchar *src, uint srclen)
+static int my_strnxfrm_utf8(CHARSET_INFO *cs, 
+			    uchar *dst, uint dstlen, 
+			    const uchar *src, uint srclen)
 {
   my_wc_t wc;
   int res;
@@ -1918,19 +1919,19 @@ int my_strnxfrm_utf8(CHARSET_INFO *cs,
   return dst - dst_orig;
 }
 
-int my_ismbchar_utf8(CHARSET_INFO *cs,const char *b, const char *e)
+static int my_ismbchar_utf8(CHARSET_INFO *cs,const char *b, const char *e)
 {
   my_wc_t wc;
   int  res=my_utf8_uni(cs,&wc, (const uchar*)b, (const uchar*)e);
   return (res>1) ? res : 0;
 }
 
-my_bool my_ismbhead_utf8(CHARSET_INFO *cs __attribute__((unused)) , uint ch)
+static my_bool my_ismbhead_utf8(CHARSET_INFO *cs __attribute__((unused)) , uint ch)
 {
   return ( ch >= 0xc2 );
 }
 
-int my_mbcharlen_utf8(CHARSET_INFO *cs  __attribute__((unused)) , uint c)
+static int my_mbcharlen_utf8(CHARSET_INFO *cs  __attribute__((unused)) , uint c)
 {
   if (c < 0x80)
     return 1;
@@ -1951,6 +1952,41 @@ int my_mbcharlen_utf8(CHARSET_INFO *cs  __attribute__((unused)) , uint c)
   return 0; /* Illegal mb head */;
 }
 
+CHARSET_INFO my_charset_utf8 =
+{
+    33,			/* number       */
+    MY_CS_COMPILED,	/* state      */
+    "utf8",		/* name         */
+    "",			/* comment    */
+    ctype_utf8,		/* ctype        */
+    to_lower_utf8,	/* to_lower     */
+    to_upper_utf8,	/* to_upper     */
+    to_upper_utf8,	/* sort_order   */
+    NULL,		/* tab_to_uni   */
+    NULL,		/* tab_from_uni */
+    1,			/* strxfrm_multiply */
+    my_strnncoll_utf8,	/* strnncoll    */
+    my_strnxfrm_utf8,	/* strnxfrm     */
+    NULL,		/* like_range   */
+    3,			/* mbmaxlen     */
+    my_ismbchar_utf8,	/* ismbchar     */
+    my_ismbhead_utf8,	/* ismbhead     */
+    my_mbcharlen_utf8,	/* mbcharlen    */
+    my_utf8_uni,	/* mb_wc        */
+    my_uni_utf8,	/* wc_mb        */
+    my_caseup_str_utf8,
+    my_casedn_str_utf8,
+    my_caseup_utf8,
+    my_casedn_utf8,
+    NULL,		/* tosort      */
+    my_strcasecmp_utf8,
+    my_strncasecmp_utf8,
+    my_hash_caseup_utf8,/* hash_caseup */
+    my_hash_sort_utf8,	/* hash_sort   */
+    0
+};
+
+
 #ifdef MY_TEST_UTF8
 
 #include <stdio.h>
@@ -2009,7 +2045,7 @@ int main()
 
 #ifdef HAVE_CHARSET_ucs2
 
-uchar ctype_ucs2[] = {
+static uchar ctype_ucs2[] = {
     0,
    32, 32, 32, 32, 32, 32, 32, 32, 32, 40, 40, 40, 40, 40, 32, 32,
    32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
@@ -2029,7 +2065,7 @@ uchar ctype_ucs2[] = {
     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0
 };
 
-uchar to_lower_ucs2[] = {
+static uchar to_lower_ucs2[] = {
     0,  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,
@@ -2048,7 +2084,7 @@ uchar to_lower_ucs2[] = {
   240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255
 };
 
-uchar to_upper_ucs2[] = {
+static uchar to_upper_ucs2[] = {
     0,  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,
@@ -2068,7 +2104,7 @@ uchar to_upper_ucs2[] = {
 };
 
 
-int my_ucs2_uni (CHARSET_INFO *cs __attribute__((unused)) , 
+static int my_ucs2_uni (CHARSET_INFO *cs __attribute__((unused)) , 
                  my_wc_t * pwc, const uchar *s, const uchar *e)
 {
   if (s+2 > e) /* Need 2 characters */
@@ -2078,7 +2114,7 @@ int my_ucs2_uni (CHARSET_INFO *cs __attribute__((unused)) ,
   return 2;
 }
 
-int my_uni_ucs2 (CHARSET_INFO *cs __attribute__((unused)) ,
+static int my_uni_ucs2 (CHARSET_INFO *cs __attribute__((unused)) ,
                  my_wc_t wc, uchar *r, uchar *e)
 {
   if ( r+2 > e ) 
@@ -2090,7 +2126,7 @@ int my_uni_ucs2 (CHARSET_INFO *cs __attribute__((unused)) ,
 }
 
 
-void my_caseup_ucs2(CHARSET_INFO *cs, char *s, uint slen)
+static void my_caseup_ucs2(CHARSET_INFO *cs, char *s, uint slen)
 {
   my_wc_t wc;
   int res;
@@ -2106,7 +2142,7 @@ void my_caseup_ucs2(CHARSET_INFO *cs, char *s, uint slen)
   }
 }
 
-uint my_hash_caseup_ucs2(CHARSET_INFO *cs, const byte *s, uint slen)
+static uint my_hash_caseup_ucs2(CHARSET_INFO *cs, const byte *s, uint slen)
 {
   my_wc_t wc;
   register uint nr=1, nr2=4;
@@ -2129,7 +2165,7 @@ uint my_hash_caseup_ucs2(CHARSET_INFO *cs, const byte *s, uint slen)
 }
 
 
-void my_hash_sort_ucs2(CHARSET_INFO *cs, const uchar *s, uint slen, ulong *n1, ulong *n2)
+static void my_hash_sort_ucs2(CHARSET_INFO *cs, const uchar *s, uint slen, ulong *n1, ulong *n2)
 {
   my_wc_t wc;
   int res;
@@ -2148,14 +2184,14 @@ void my_hash_sort_ucs2(CHARSET_INFO *cs, const uchar *s, uint slen, ulong *n1, u
 }
 
 
-void my_caseup_str_ucs2(CHARSET_INFO * cs  __attribute__((unused)), 
+static void my_caseup_str_ucs2(CHARSET_INFO * cs  __attribute__((unused)), 
                         char * s __attribute__((unused)))
 {
 }
 
 
 
-void my_casedn_ucs2(CHARSET_INFO *cs, char *s, uint slen)
+static void my_casedn_ucs2(CHARSET_INFO *cs, char *s, uint slen)
 {
   my_wc_t wc;
   int res;
@@ -2173,13 +2209,13 @@ void my_casedn_ucs2(CHARSET_INFO *cs, char *s, uint slen)
   }
 }
 
-void my_casedn_str_ucs2(CHARSET_INFO *cs __attribute__((unused)), 
+static void my_casedn_str_ucs2(CHARSET_INFO *cs __attribute__((unused)), 
                         char * s __attribute__((unused)))
 {
 }
 
 
-int my_strnncoll_ucs2(CHARSET_INFO *cs, 
+static int my_strnncoll_ucs2(CHARSET_INFO *cs, 
 		const uchar *s, uint slen, const uchar *t, uint tlen)
 {
   int s_res,t_res;
@@ -2214,7 +2250,7 @@ int my_strnncoll_ucs2(CHARSET_INFO *cs,
   return ( (se-s) - (te-t) );
 }
 
-int my_strncasecmp_ucs2(CHARSET_INFO *cs,
+static int my_strncasecmp_ucs2(CHARSET_INFO *cs,
 		const char *s, const char *t,  uint len)
 {
   int s_res,t_res;
@@ -2250,7 +2286,7 @@ int my_strncasecmp_ucs2(CHARSET_INFO *cs,
   return ( (se-s) - (te-t) );
 }
 
-int my_strcasecmp_ucs2(CHARSET_INFO *cs, const char *s, const char *t)
+static int my_strcasecmp_ucs2(CHARSET_INFO *cs, const char *s, const char *t)
 {
   uint s_len=strlen(s);
   uint t_len=strlen(t);
@@ -2258,7 +2294,7 @@ int my_strcasecmp_ucs2(CHARSET_INFO *cs, const char *s, const char *t)
   return  my_strncasecmp_ucs2(cs, s, t, len);
 }
 
-int my_strnxfrm_ucs2(CHARSET_INFO *cs, 
+static int my_strnxfrm_ucs2(CHARSET_INFO *cs, 
 	uchar *dst, uint dstlen, const uchar *src, uint srclen)
 {
   my_wc_t wc;
@@ -2289,23 +2325,59 @@ int my_strnxfrm_ucs2(CHARSET_INFO *cs,
   return dst - dst_orig;
 }
 
-int my_ismbchar_ucs2(CHARSET_INFO *cs __attribute__((unused)),
+static int my_ismbchar_ucs2(CHARSET_INFO *cs __attribute__((unused)),
                      const char *b __attribute__((unused)),
                      const char *e __attribute__((unused)))
 {
   return 2;
 }
 
-my_bool my_ismbhead_ucs2(CHARSET_INFO *cs __attribute__((unused)) , 
+static my_bool my_ismbhead_ucs2(CHARSET_INFO *cs __attribute__((unused)) , 
                          uint ch __attribute__((unused)))
 {
   return 1;
 }
 
-int my_mbcharlen_ucs2(CHARSET_INFO *cs  __attribute__((unused)) , 
+static int my_mbcharlen_ucs2(CHARSET_INFO *cs  __attribute__((unused)) , 
                       uint c __attribute__((unused)))
 {
   return 2;
 }
 
+
+CHARSET_INFO my_charset_ucs2 =
+{
+    35,			/* number       */
+    MY_CS_COMPILED,	/* state      */
+    "ucs2",		/* name         */
+    "",			/* comment    */
+    ctype_ucs2,		/* ctype        */
+    to_lower_ucs2,	/* to_lower     */
+    to_upper_ucs2,	/* to_upper     */
+    to_upper_ucs2,	/* sort_order   */
+    NULL,		/* tab_to_uni   */
+    NULL,		/* tab_from_uni */
+    1,			/* strxfrm_multiply */
+    my_strnncoll_ucs2,	/* strnncoll    */
+    my_strnxfrm_ucs2,	/* strnxfrm     */
+    NULL,		/* like_range   */
+    2,			/* mbmaxlen     */
+    my_ismbchar_ucs2,	/* ismbchar     */
+    my_ismbhead_ucs2,	/* ismbhead     */
+    my_mbcharlen_ucs2,	/* mbcharlen    */
+    my_ucs2_uni,	/* mb_wc        */
+    my_uni_ucs2,	/* wc_mb        */
+    my_caseup_str_ucs2,
+    my_casedn_str_ucs2,
+    my_caseup_ucs2,
+    my_casedn_ucs2,
+    NULL,		/* tosort      */
+    my_strcasecmp_ucs2,
+    my_strncasecmp_ucs2,
+    my_hash_caseup_ucs2,/* hash_caseup */
+    my_hash_sort_ucs2,	/* hash_sort   */
+    0
+};
+
+
 #endif
diff --git a/strings/ctype-win1250ch.c b/strings/ctype-win1250ch.c
index c8ea1bf1f9f..e738d7727bc 100644
--- a/strings/ctype-win1250ch.c
+++ b/strings/ctype-win1250ch.c
@@ -35,7 +35,106 @@
 #include "m_string.h"
 #include "m_ctype.h"
 
-uchar NEAR ctype_win1250ch[] = {
+static uint16 tab_cp1250_uni[256]={
+     0,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,
+0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F,
+0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,
+0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F,
+0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,
+0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F,
+0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,
+0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F,
+0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,
+0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F,
+0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,
+0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F,
+0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,
+0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F,
+0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,
+0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F,
+0x20AC,     0,0x201A,     0,0x201E,0x2026,0x2020,0x2021,
+     0,0x2030,0x0160,0x2039,0x015A,0x0164,0x017D,0x0179,
+     0,0x2018,0x2019,0x201C,0x201D,0x2022,0x2013,0x2014,
+     0,0x2122,0x0161,0x203A,0x015B,0x0165,0x017E,0x017A,
+0x00A0,0x02C7,0x02D8,0x0141,0x00A4,0x0104,0x00A6,0x00A7,
+0x00A8,0x00A9,0x015E,0x00AB,0x00AC,0x00AD,0x00AE,0x017B,
+0x00B0,0x00B1,0x02DB,0x0142,0x00B4,0x00B5,0x00B6,0x00B7,
+0x00B8,0x0105,0x015F,0x00BB,0x013D,0x02DD,0x013E,0x017C,
+0x0154,0x00C1,0x00C2,0x0102,0x00C4,0x0139,0x0106,0x00C7,
+0x010C,0x00C9,0x0118,0x00CB,0x011A,0x00CD,0x00CE,0x010E,
+0x0110,0x0143,0x0147,0x00D3,0x00D4,0x0150,0x00D6,0x00D7,
+0x0158,0x016E,0x00DA,0x0170,0x00DC,0x00DD,0x0162,0x00DF,
+0x0155,0x00E1,0x00E2,0x0103,0x00E4,0x013A,0x0107,0x00E7,
+0x010D,0x00E9,0x0119,0x00EB,0x011B,0x00ED,0x00EE,0x010F,
+0x0111,0x0144,0x0148,0x00F3,0x00F4,0x0151,0x00F6,0x00F7,
+0x0159,0x016F,0x00FA,0x0171,0x00FC,0x00FD,0x0163,0x02D9
+};
+
+
+/* 0000-00FD , 254 chars */
+static uchar tab_uni_cp1250_plane00[]={
+0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,
+0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F,
+0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F,
+0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F,
+0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F,
+0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F,
+0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F,
+0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0xA0,0x00,0x00,0x00,0xA4,0x00,0xA6,0xA7,0xA8,0xA9,0x00,0xAB,0xAC,0xAD,0xAE,0x00,
+0xB0,0xB1,0x00,0x00,0xB4,0xB5,0xB6,0xB7,0xB8,0x00,0x00,0xBB,0x00,0x00,0x00,0x00,
+0x00,0xC1,0xC2,0x00,0xC4,0x00,0x00,0xC7,0x00,0xC9,0x00,0xCB,0x00,0xCD,0xCE,0x00,
+0x00,0x00,0x00,0xD3,0xD4,0x00,0xD6,0xD7,0x00,0x00,0xDA,0x00,0xDC,0xDD,0x00,0xDF,
+0x00,0xE1,0xE2,0x00,0xE4,0x00,0x00,0xE7,0x00,0xE9,0x00,0xEB,0x00,0xED,0xEE,0x00,
+0x00,0x00,0x00,0xF3,0xF4,0x00,0xF6,0xF7,0x00,0x00,0xFA,0x00,0xFC,0xFD};
+
+/* 0102-017E , 125 chars */
+static uchar tab_uni_cp1250_plane01[]={
+0xC3,0xE3,0xA5,0xB9,0xC6,0xE6,0x00,0x00,0x00,0x00,0xC8,0xE8,0xCF,0xEF,0xD0,0xF0,
+0x00,0x00,0x00,0x00,0x00,0x00,0xCA,0xEA,0xCC,0xEC,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC5,0xE5,0x00,0x00,0xBC,0xBE,0x00,0x00,0xA3,
+0xB3,0xD1,0xF1,0x00,0x00,0xD2,0xF2,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xD5,0xF5,
+0x00,0x00,0xC0,0xE0,0x00,0x00,0xD8,0xF8,0x8C,0x9C,0x00,0x00,0xAA,0xBA,0x8A,0x9A,
+0xDE,0xFE,0x8D,0x9D,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xD9,0xF9,0xDB,0xFB,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x8F,0x9F,0xAF,0xBF,0x8E,0x9E};
+
+/* 2013-20AC , 154 chars */
+static uchar tab_uni_cp1250_plane20[]={
+0x96,0x97,0x00,0x00,0x00,0x91,0x92,0x82,0x00,0x93,0x94,0x84,0x00,0x86,0x87,0x95,
+0x00,0x00,0x00,0x85,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x89,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x8B,0x9B,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80};
+
+/* 02C7-02DD ,  23 chars */
+static uchar tab_uni_cp1250_plane02[]={
+0xA1,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0xA2,0xFF,0x00,0xB2,0x00,0xBD};
+
+/* 2122-2122 ,   1 chars */
+static uchar tab_uni_cp1250_plane21[]={
+0x99};
+
+
+static MY_UNI_IDX idx_uni_cp1250[]={
+  {0x0000,0x00FD,tab_uni_cp1250_plane00},
+  {0x0102,0x017E,tab_uni_cp1250_plane01},
+  {0x2013,0x20AC,tab_uni_cp1250_plane20},
+  {0x02C7,0x02DD,tab_uni_cp1250_plane02},
+  {0x2122,0x2122,tab_uni_cp1250_plane21},
+  {0,0,NULL}
+};
+
+
+static uchar NEAR ctype_win1250ch[] = {
 0x00,
 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
 0x20, 0x28, 0x28, 0x28, 0x28, 0x28, 0x20, 0x20,
@@ -71,7 +170,7 @@ uchar NEAR ctype_win1250ch[] = {
 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x10
 };
 
-uchar NEAR to_lower_win1250ch[] = {
+static uchar NEAR to_lower_win1250ch[] = {
 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
@@ -106,7 +205,7 @@ uchar NEAR to_lower_win1250ch[] = {
 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
 };
 
-uchar NEAR to_upper_win1250ch[] = {
+static uchar NEAR to_upper_win1250ch[] = {
 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
@@ -149,7 +248,7 @@ uchar NEAR to_upper_win1250ch[] = {
 #endif
 
 
-uchar NEAR sort_order_win1250ch[] = {
+static uchar NEAR sort_order_win1250ch[] = {
 0, 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,
@@ -168,7 +267,7 @@ uchar NEAR sort_order_win1250ch[] = {
 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255
 };
 
-uchar NEAR _sort_order_win1250ch1[] = {
+static uchar NEAR _sort_order_win1250ch1[] = {
 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
@@ -228,7 +327,7 @@ uchar NEAR _sort_order_win1250ch1[] = {
 0xb8, 0xbd, 0xbd, 0xbd, 0xbd, 0xc1, 0xbc, 0xf5
 };
 
-uchar NEAR _sort_order_win1250ch2[] = {
+static uchar NEAR _sort_order_win1250ch2[] = {
 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09,
 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11,
 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19,
@@ -334,7 +433,8 @@ static struct wordvalue doubles[] = {
 
 #define IS_END(p, src, len)	(!(*p))
 
-int my_strcoll_win1250ch(const uchar * s1, const uchar * s2) {
+#if UNUSED
+static int my_strcoll_win1250ch(const uchar * s1, const uchar * s2) {
 	int v1, v2;
 	const uchar * p1, * p2;
 	int pass1 = 0, pass2 = 0;
@@ -350,9 +450,10 @@ int my_strcoll_win1250ch(const uchar * s1, const uchar * s2) {
 	} while (v1);
 	return 0;
 }
+#endif
 
 #ifdef UNUSED
-int my_strxfrm_win1250ch(uchar * dest, const uchar * src, int len) {
+static int my_strxfrm_win1250ch(uchar * dest, const uchar * src, int len) {
 	int value;
 	const uchar * p;
 	int pass = 0;
@@ -373,7 +474,7 @@ int my_strxfrm_win1250ch(uchar * dest, const uchar * src, int len) {
 
 #define IS_END(p, src, len)	(((char *)p - (char *)src) >= (len))
 
-int my_strnncoll_win1250ch(CHARSET_INFO *cs __attribute__((unused)), 
+static int my_strnncoll_win1250ch(CHARSET_INFO *cs __attribute__((unused)), 
 				const uchar * s1, uint len1,
 				const uchar * s2, uint len2) {
 	int v1, v2;
@@ -392,7 +493,7 @@ int my_strnncoll_win1250ch(CHARSET_INFO *cs __attribute__((unused)),
 	return 0;
 }
 
-int my_strnxfrm_win1250ch(CHARSET_INFO * cs  __attribute__((unused)),
+static int my_strnxfrm_win1250ch(CHARSET_INFO * cs  __attribute__((unused)),
 			  uchar * dest, uint len, 
 			  const uchar * src, uint srclen) {
 	int value;
@@ -474,7 +575,7 @@ static uchar NEAR like_range_prefix_max_win1250ch[] = {
 ** optimized !
 */
 
-my_bool my_like_range_win1250ch(CHARSET_INFO *cs __attribute__((unused)),
+static my_bool my_like_range_win1250ch(CHARSET_INFO *cs __attribute__((unused)),
 	const char *ptr, uint ptr_length,
 	pchar escape, uint res_length,
 	char *min_str, char *max_str,
@@ -518,4 +619,40 @@ my_bool my_like_range_win1250ch(CHARSET_INFO *cs __attribute__((unused)),
 	return 0;
 }
 
+
+CHARSET_INFO my_charset_win1250ch =
+{
+    34,				/* number    */
+    MY_CS_COMPILED,		/* state     */
+    "win1250ch",		/* name      */
+    "",				/* comment   */
+    ctype_win1250ch,
+    to_lower_win1250ch,
+    to_upper_win1250ch,
+    sort_order_win1250ch,
+    tab_cp1250_uni,		/* tab_to_uni   */
+    idx_uni_cp1250,		/* tab_from_uni */
+    2,				/* strxfrm_multiply */
+    my_strnncoll_win1250ch,
+    my_strnxfrm_win1250ch,
+    my_like_range_win1250ch,
+    0,				/* mbmaxlen  */
+    NULL,			/* ismbchar  */
+    NULL,			/* ismbhead  */
+    NULL,			/* mbcharlen */
+    my_mb_wc_8bit,		/* mb_wc     */
+    my_wc_mb_8bit,		/* wc_mb     */
+    my_caseup_str_8bit,
+    my_casedn_str_8bit,
+    my_caseup_8bit,
+    my_casedn_8bit,
+    NULL,			/* tosort      */
+    my_strcasecmp_8bit,
+    my_strncasecmp_8bit,
+    NULL,			/* hash_caseup */
+    NULL,			/* hash_sort   */
+    0
+};
+
+
 #endif
diff --git a/strings/ctype.c b/strings/ctype.c
index 1abb7a5d2c8..91e20508558 100644
--- a/strings/ctype.c
+++ b/strings/ctype.c
@@ -83,7 +83,7 @@ static MY_UNI_IDX idx_uni_8859_1[]={
 #endif
 
 #if defined(HAVE_CHARSET_latin2)||defined(HAVE_CHARSET_croat)||\
-defined(HAVE_CHARSET_hungarian)||defined(HAVE_CHARSET_czech)
+defined(HAVE_CHARSET_hungarian)
 
 static uint16 tab_8859_2_uni[256]={
      0,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,
@@ -2529,7 +2529,7 @@ static uchar sort_order_win1250[] = {
 };
 #endif
 
-#if defined(HAVE_CHARSET_win1250)||defined(HAVE_CHARSET_win1250ch)
+#if defined(HAVE_CHARSET_win1250)
 
 static uint16 tab_cp1250_uni[256]={
      0,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,
@@ -2801,7 +2801,7 @@ static uchar sort_order_win1251ukr[] = {
 
 
 
-CHARSET_INFO compiled_charsets[] = {
+static CHARSET_INFO compiled_charsets[] = {
 
 #ifdef HAVE_CHARSET_latin1
   {
@@ -2838,40 +2838,6 @@ CHARSET_INFO compiled_charsets[] = {
   },
 #endif
 
-#ifdef HAVE_CHARSET_big5
-  {
-    1,			/* number */
-    MY_CS_COMPILED,	/* state      */
-    "big5",		/* name */
-    "",			/* comment    */
-    ctype_big5,
-    to_lower_big5,
-    to_upper_big5,
-    sort_order_big5,
-    NULL,		/* tab_to_uni   */
-    NULL,		/* tab_from_uni */
-    1,			/* strxfrm_multiply */
-    my_strnncoll_big5,
-    my_strnxfrm_big5,
-    my_like_range_big5,
-    2,			/* mbmaxlen */
-    ismbchar_big5,
-    ismbhead_big5,
-    mbcharlen_big5,
-    my_mb_wc_big5,	/* mb_wc      */
-    my_wc_mb_big5,	/* wc_mb      */
-    my_caseup_str_mb,
-    my_casedn_str_mb,
-    my_caseup_mb,
-    my_casedn_mb,
-    NULL,		/* tosort      */
-    my_strcasecmp_mb,
-    my_strncasecmp_mb,
-    NULL,		/* hash_caseup */
-    NULL,		/* hash_sort   */
-    0
-  },
-#endif
 
 #ifdef HAVE_CHARSET_cp1251
   {
@@ -2978,40 +2944,6 @@ CHARSET_INFO compiled_charsets[] = {
   },
 #endif
 
-#ifdef HAVE_CHARSET_czech
-  {
-    2,			/* number */
-    MY_CS_COMPILED,	/* state      */
-    "czech",		/* name */
-    "",			/* comment    */
-    ctype_czech,
-    to_lower_czech,
-    to_upper_czech,
-    sort_order_czech,
-    tab_8859_2_uni,	/* tab_to_uni   */
-    idx_uni_8859_2,	/* tab_from_uni */
-    4,			/* strxfrm_multiply */
-    my_strnncoll_czech,
-    my_strnxfrm_czech,
-    my_like_range_czech,
-    0,			/* mbmaxlen  */
-    NULL,		/* ismbchar  */
-    NULL,		/* ismbhead  */
-    NULL,		/* mbcharlen */
-    my_mb_wc_8bit,	/* mb_wc   */
-    my_wc_mb_8bit,	/* wc_mb   */
-    my_caseup_str_8bit,
-    my_casedn_str_8bit,
-    my_caseup_8bit,
-    my_casedn_8bit,
-    NULL,		/* tosort      */
-    my_strcasecmp_8bit,
-    my_strncasecmp_8bit,
-    NULL,		/* hash_caseup */
-    NULL,		/* hash_sort   */
-    0
-  },
-#endif
 
 #ifdef HAVE_CHARSET_danish
   {
@@ -3153,110 +3085,6 @@ CHARSET_INFO compiled_charsets[] = {
   },
 #endif
 
-#ifdef HAVE_CHARSET_euc_kr
-  {
-    19,			/* number */
-    MY_CS_COMPILED,	/* state      */
-    "euc_kr",		/* name */
-    "",			/* comment    */
-    ctype_euc_kr,
-    to_lower_euc_kr,
-    to_upper_euc_kr,
-    sort_order_euc_kr,
-    NULL,		/* tab_to_uni   */
-    NULL,		/* tab_from_uni */
-    0,			/* strxfrm_multiply */
-    my_strnncoll_simple,/* strnncoll  */
-    NULL,		/* strnxfrm   */
-    NULL,		/* like_range */
-    2,			/* mbmaxlen */
-    ismbchar_euc_kr,
-    ismbhead_euc_kr,
-    mbcharlen_euc_kr,
-    my_mb_wc_euc_kr,	/* mb_wc   */
-    my_wc_mb_euc_kr,	/* wc_mb   */
-    my_caseup_str_mb,
-    my_casedn_str_mb,
-    my_caseup_mb,
-    my_casedn_mb,
-    my_tosort_8bit,
-    my_strcasecmp_mb,
-    my_strncasecmp_mb,
-    NULL,		/* hash_caseup */
-    NULL,		/* hash_sort   */
-    0
-  },
-#endif
-
-#ifdef HAVE_CHARSET_gb2312
-  {
-    24,			/* number */
-    MY_CS_COMPILED,	/* state      */
-    "gb2312",		/* name */
-    "",			/* comment    */
-    ctype_gb2312,
-    to_lower_gb2312,
-    to_upper_gb2312,
-    sort_order_gb2312,
-    NULL,		/* tab_to_uni   */
-    NULL,		/* tab_from_uni */
-    0,			/* strxfrm_multiply */
-    my_strnncoll_simple,/* strnncoll  */
-    NULL,		/* strnxfrm   */
-    NULL,		/* like_range */
-    2,			/* mbmaxlen */
-    ismbchar_gb2312,
-    ismbhead_gb2312,
-    mbcharlen_gb2312,
-    my_mb_wc_gb2312,	/* mb_wc      */
-    my_wc_mb_gb2312,	/* wc_mb      */
-    my_caseup_str_mb,
-    my_casedn_str_mb,
-    my_caseup_mb,
-    my_casedn_mb,
-    my_tosort_8bit,
-    my_strcasecmp_mb,
-    my_strncasecmp_mb,
-    NULL,		/* hash_caseup */
-    NULL,		/* hash_sort   */
-    0
-  },
-#endif
-
-#ifdef HAVE_CHARSET_gbk
-  {
-    28,			/* number */
-    MY_CS_COMPILED,	/* state      */
-    "gbk",		/* name */
-    "",			/* comment    */
-    ctype_gbk,
-    to_lower_gbk,
-    to_upper_gbk,
-    sort_order_gbk,
-    NULL,		/* tab_to_uni   */
-    NULL,		/* tab_from_uni */
-    1,			/* strxfrm_multiply */
-    my_strnncoll_gbk,
-    my_strnxfrm_gbk,
-    my_like_range_gbk,
-    2,			/* mbmaxlen */
-    ismbchar_gbk,
-    ismbhead_gbk,
-    mbcharlen_gbk,
-    my_mb_wc_gbk,	/* mb_wc      */
-    my_wc_mb_gbk,	/* wc_mb      */
-    my_caseup_str_mb,
-    my_casedn_str_mb,
-    my_caseup_mb,
-    my_casedn_mb,
-    NULL,		/* tosort      */
-    my_strcasecmp_mb,
-    my_strncasecmp_mb,
-    NULL,		/* hash_caseup */
-    NULL,		/* hash_sort   */
-    0
-  },
-#endif
 
 #ifdef HAVE_CHARSET_german1
   {
@@ -3503,40 +3331,6 @@ CHARSET_INFO compiled_charsets[] = {
   },
 #endif
 
-#ifdef HAVE_CHARSET_latin1_de
-  {
-    31,			/* number */
-    MY_CS_COMPILED,	/* state      */
-    "latin1_de",	/* name */
-    "",			/* comment    */
-    ctype_latin1_de,
-    to_lower_latin1_de,
-    to_upper_latin1_de,
-    sort_order_latin1_de,
-    tab_8859_1_uni,	/* tab_to_uni   */
-    idx_uni_8859_1,	/* tab_from_uni */
-    2,			/* strxfrm_multiply */
-    my_strnncoll_latin1_de,
-    my_strnxfrm_latin1_de,
-    my_like_range_latin1_de,
-    0,			/* mbmaxlen  */
-    NULL,		/* ismbchar  */
-    NULL,		/* ismbhead  */
-    NULL,		/* mbcharlen */
-    my_mb_wc_8bit,	/* mb_wc   */
-    my_wc_mb_8bit,	/* wc_mb   */
-    my_caseup_str_8bit,
-    my_casedn_str_8bit,
-    my_caseup_8bit,
-    my_casedn_8bit,
-    NULL,		/* tosort      */
-    my_strcasecmp_8bit,
-    my_strncasecmp_8bit,
-    NULL,		/* hash_caseup */
-    NULL,		/* hash_sort   */
-    0
-  },
-#endif
 
 #ifdef HAVE_CHARSET_latin2
   {
@@ -3608,40 +3402,6 @@ CHARSET_INFO compiled_charsets[] = {
   },
 #endif
 
-#ifdef HAVE_CHARSET_sjis
-  {
-    13,			/* number */
-    MY_CS_COMPILED,	/* state      */
-    "sjis",		/* name */
-    "",			/* comment    */
-    ctype_sjis,
-    to_lower_sjis,
-    to_upper_sjis,
-    sort_order_sjis,
-    NULL,		/* tab_to_uni   */
-    NULL,		/* tab_from_uni */
-    1,			/* strxfrm_multiply */
-    my_strnncoll_sjis,
-    my_strnxfrm_sjis,
-    my_like_range_sjis,
-    2,			/* mbmaxlen */
-    ismbchar_sjis,
-    ismbhead_sjis,
-    mbcharlen_sjis,
-    my_mb_wc_sjis,	/* mb_wc */
-    my_wc_mb_sjis,	/* wc_mb */
-    my_caseup_str_8bit,
-    my_casedn_str_8bit,
-    my_caseup_8bit,
-    my_casedn_8bit,
-    NULL,		/* tosort      */
-    my_strcasecmp_8bit,
-    my_strncasecmp_8bit,
-    NULL,		/* hash_caseup */
-    NULL,		/* hash_sort   */
-    0
-  },
-#endif
 
 #ifdef HAVE_CHARSET_swe7
   {
@@ -3678,146 +3438,6 @@ CHARSET_INFO compiled_charsets[] = {
   },
 #endif
 
-#ifdef HAVE_CHARSET_tis620
-  {
-    18,			/* number */
-    MY_CS_COMPILED,	/* state      */
-    "tis620",		/* name */
-    "",			/* comment    */
-    ctype_tis620,
-    to_lower_tis620,
-    to_upper_tis620,
-    sort_order_tis620,
-    NULL,		/* tab_to_uni   */
-    NULL,		/* tab_from_uni */
-    4,			/* strxfrm_multiply */
-    my_strnncoll_tis620,
-    my_strnxfrm_tis620,
-    my_like_range_tis620,
-    0,			/* mbmaxlen  */
-    NULL,		/* ismbchar  */
-    NULL,		/* ismbhead  */
-    NULL,		/* mbcharlen */
-    my_mb_wc_8bit,	/* mb_wc   */
-    my_wc_mb_8bit,	/* wc_mb   */
-    my_caseup_str_8bit,
-    my_casedn_str_8bit,
-    my_caseup_8bit,
-    my_casedn_8bit,
-    NULL,		/* tosort      */
-    my_strcasecmp_8bit,
-    my_strncasecmp_8bit,
-    NULL,		/* hash_caseup */
-    NULL,		/* hash_sort   */
-    0
-  },
-#endif
-
-#ifdef HAVE_CHARSET_ucs2
-  {
-    35,			/* number       */
-    MY_CS_COMPILED,	/* state      */
-    "ucs2",		/* name         */
-    "",			/* comment    */
-    ctype_ucs2,		/* ctype        */
-    to_lower_ucs2,	/* to_lower     */
-    to_upper_ucs2,	/* to_upper     */
-    to_upper_ucs2,	/* sort_order   */
-    NULL,		/* tab_to_uni   */
-    NULL,		/* tab_from_uni */
-    1,			/* strxfrm_multiply */
-    my_strnncoll_ucs2,	/* strnncoll    */
-    my_strnxfrm_ucs2,	/* strnxfrm     */
-    NULL,		/* like_range   */
-    2,			/* mbmaxlen     */
-    my_ismbchar_ucs2,	/* ismbchar     */
-    my_ismbhead_ucs2,	/* ismbhead     */
-    my_mbcharlen_ucs2,	/* mbcharlen    */
-    my_ucs2_uni,	/* mb_wc        */
-    my_uni_ucs2,	/* wc_mb        */
-    my_caseup_str_ucs2,
-    my_casedn_str_ucs2,
-    my_caseup_ucs2,
-    my_casedn_ucs2,
-    NULL,		/* tosort      */
-    my_strcasecmp_ucs2,
-    my_strncasecmp_ucs2,
-    my_hash_caseup_ucs2,/* hash_caseup */
-    my_hash_sort_ucs2,	/* hash_sort   */
-    0
-  },
-#endif
-
-
-#ifdef HAVE_CHARSET_ujis
-  {
-    12,			/* number       */
-    MY_CS_COMPILED,	/* state      */
-    "ujis",		/* name         */
-    "",			/* comment    */
-    ctype_ujis,
-    to_lower_ujis,
-    to_upper_ujis,
-    sort_order_ujis,
-    NULL,		/* tab_to_uni   */
-    NULL,		/* tab_from_uni */
-    0,			/* strxfrm_multiply */
-    NULL,		/* strnncoll    */
-    NULL,		/* strnxfrm     */
-    NULL,		/* like_range   */
-    3,			/* mbmaxlen     */
-    ismbchar_ujis,
-    ismbhead_ujis,
-    mbcharlen_ujis,
-    my_mb_wc_euc_jp,	 /* mb_wc       */
-    my_wc_mb_euc_jp,	 /* wc_mb       */
-    my_caseup_str_mb,
-    my_casedn_str_mb,
-    my_caseup_mb,
-    my_casedn_mb,
-    my_tosort_8bit,
-    my_strcasecmp_mb,
-    my_strncasecmp_mb,
-    NULL,		/* hash_caseup */
-    NULL,		/* hash_sort   */
-    0
-  },
-#endif
-
-#ifdef HAVE_CHARSET_utf8
-  {
-    33,			/* number       */
-    MY_CS_COMPILED,	/* state      */
-    "utf8",		/* name         */
-    "",			/* comment    */
-    ctype_utf8,		/* ctype        */
-    to_lower_utf8,	/* to_lower     */
-    to_upper_utf8,	/* to_upper     */
-    to_upper_utf8,	/* sort_order   */
-    NULL,		/* tab_to_uni   */
-    NULL,		/* tab_from_uni */
-    1,			/* strxfrm_multiply */
-    my_strnncoll_utf8,	/* strnncoll    */
-    my_strnxfrm_utf8,	/* strnxfrm     */
-    NULL,		/* like_range   */
-    3,			/* mbmaxlen     */
-    my_ismbchar_utf8,	/* ismbchar     */
-    my_ismbhead_utf8,	/* ismbhead     */
-    my_mbcharlen_utf8,	/* mbcharlen    */
-    my_utf8_uni,	/* mb_wc        */
-    my_uni_utf8,	/* wc_mb        */
-    my_caseup_str_utf8,
-    my_casedn_str_utf8,
-    my_caseup_utf8,
-    my_casedn_utf8,
-    NULL,		/* tosort      */
-    my_strcasecmp_utf8,
-    my_strncasecmp_utf8,
-    my_hash_caseup_utf8,/* hash_caseup */
-    my_hash_sort_utf8,	/* hash_sort   */
-    0
-  },
-#endif
 
 #ifdef HAVE_CHARSET_usa7
   {
@@ -3994,41 +3614,6 @@ CHARSET_INFO compiled_charsets[] = {
   },
 #endif
 
-#ifdef HAVE_CHARSET_win1250ch
-  {
-    34,				/* number    */
-    MY_CS_COMPILED,		/* state     */
-    "win1250ch",		/* name      */
-    "",				/* comment   */
-    ctype_win1250ch,
-    to_lower_win1250ch,
-    to_upper_win1250ch,
-    sort_order_win1250ch,
-    tab_cp1250_uni,		/* tab_to_uni   */
-    idx_uni_cp1250,		/* tab_from_uni */
-    2,				/* strxfrm_multiply */
-    my_strnncoll_win1250ch,
-    my_strnxfrm_win1250ch,
-    my_like_range_win1250ch,
-    0,				/* mbmaxlen  */
-    NULL,			/* ismbchar  */
-    NULL,			/* ismbhead  */
-    NULL,			/* mbcharlen */
-    my_mb_wc_8bit,		/* mb_wc     */
-    my_wc_mb_8bit,		/* wc_mb     */
-    my_caseup_str_8bit,
-    my_casedn_str_8bit,
-    my_caseup_8bit,
-    my_casedn_8bit,
-    NULL,			/* tosort      */
-    my_strcasecmp_8bit,
-    my_strncasecmp_8bit,
-    NULL,			/* hash_caseup */
-    NULL,			/* hash_sort   */
-    0
-  },
-#endif
-
   {
     0,			/* end-of-list marker */
     0,			/* state      */
@@ -4066,45 +3651,84 @@ CHARSET_INFO compiled_charsets[] = {
 };
 
 
+CHARSET_INFO *all_charsets[256];
 CHARSET_INFO *default_charset_info = &compiled_charsets[0];
 CHARSET_INFO *system_charset_info = &compiled_charsets[0];
 
-CHARSET_INFO *find_compiled_charset(uint cs_number)
+#define MY_ADD_CHARSET(x)	all_charsets[(x)->number]=(x)
+
+
+extern CHARSET_INFO my_charset_big5;
+extern CHARSET_INFO my_charset_czech;
+extern CHARSET_INFO my_charset_euc_kr;
+extern CHARSET_INFO my_charset_gb2312;
+extern CHARSET_INFO my_charset_gbk;
+extern CHARSET_INFO my_charset_latin1_de;
+extern CHARSET_INFO my_charset_sjis;
+extern CHARSET_INFO my_charset_tis620;
+extern CHARSET_INFO my_charset_ucs2;
+extern CHARSET_INFO my_charset_ujis;
+extern CHARSET_INFO my_charset_utf8;
+extern CHARSET_INFO my_charset_win1250ch;
+
+
+my_bool init_compiled_charsets(myf flags  __attribute__((unused)))
 {
   CHARSET_INFO *cs;
-  for (cs = compiled_charsets; cs->number > 0; cs++)
-    if (cs->number == cs_number)
-      return cs;
 
-  return NULL;
-}
-
-CHARSET_INFO *find_compiled_charset_by_name(const char *name)
-{
-  CHARSET_INFO *cs;
-  for (cs = compiled_charsets; cs->number > 0; cs++)
-    if (!strcmp(cs->name, name))
-      return cs;
-
-  return NULL;
-}
-
-uint compiled_charset_number(const char *name)
-{
-  CHARSET_INFO *cs;
-  for (cs = compiled_charsets; cs->number > 0; cs++)
-    if (!strcmp(cs->name, name))
-      return cs->number;
-
-  return 0;   /* this mimics find_type() */
-}
-
-const char *compiled_charset_name(uint charset_number)
-{
-  CHARSET_INFO *cs;
-  for (cs = compiled_charsets; cs->number > 0; cs++)
-    if (cs->number == charset_number)
-      return cs->name;
-
-  return "?";   /* this mimics get_type() */
+#ifdef HAVE_CHARSET_big5
+  MY_ADD_CHARSET(&my_charset_big5);
+#endif
+
+#ifdef HAVE_CHARSET_czech
+  MY_ADD_CHARSET(&my_charset_czech);
+#endif
+
+#ifdef HAVE_CHARSET_euc_kr
+  MY_ADD_CHARSET(&my_charset_euc_kr);
+#endif
+
+#ifdef HAVE_CHARSET_gb2312
+  MY_ADD_CHARSET(&my_charset_gb2312);
+#endif
+
+#ifdef HAVE_CHARSET_gbk
+  MY_ADD_CHARSET(&my_charset_gbk);
+#endif
+
+#ifdef HAVE_CHARSET_latin1_de
+  MY_ADD_CHARSET(&my_charset_latin1_de);
+#endif
+
+#ifdef HAVE_CHARSET_sjis
+  MY_ADD_CHARSET(&my_charset_sjis);
+#endif
+
+#ifdef HAVE_CHARSET_tis620
+  MY_ADD_CHARSET(&my_charset_tis620);
+#endif
+
+#ifdef HAVE_CHARSET_ucs2
+  MY_ADD_CHARSET(&my_charset_ucs2);
+#endif
+
+#ifdef HAVE_CHARSET_ujis
+  MY_ADD_CHARSET(&my_charset_ujis);
+#endif
+
+#ifdef HAVE_CHARSET_utf8
+  MY_ADD_CHARSET(&my_charset_utf8);
+#endif
+
+#ifdef HAVE_CHARSET_win1250ch
+  MY_ADD_CHARSET(&my_charset_win1250ch);
+#endif
+  
+  /* Copy compiled charsets */
+  for (cs=compiled_charsets; cs->name; cs++)
+  {
+    all_charsets[cs->number]=cs;
+  }
+  
+  return FALSE;
 }