23 #include <my_global.h>
26 #include <mysql_version.h>
40 static int chcmp(
const void *vf,
const void *vs)
45 return f->srt-s->srt ? f->srt-s->srt : f->uni-s->uni;
58 printf(
"<BODY><PRE>\n");
59 printf(
"Charset %s\n",cs->name);
62 printf(
"<TR><TH>Code<TH>Uni<TH>Sort<TH>Ctype<TH>Ch<TH>Lo<TH>Up</TR>");
67 ch[
i].srt=cs->sort_order ? cs->sort_order[
i] :
i;
68 ch[
i].uni=cs->tab_to_uni[
i];
69 ch[
i].low=cs->tab_to_uni[cs->to_lower[
i]];
70 ch[
i].upp=cs->tab_to_uni[cs->to_upper[
i]];
71 ch[
i].ctp=cs->ctype[i+1];
74 qsort(ch,256,
sizeof(
MY_CH),&chcmp);
79 clr = (srt!=ch[
i].srt) ? !clr : clr;
81 printf(
"<TR bgcolor=#%s>",clr ?
"DDDDDD" :
"EEEE99");
82 printf(
"<TD>%02X",ch[i].cod);
83 printf(
"<TD>%04X",ch[i].uni);
84 printf(
"<TD>%02X",ch[i].srt);
86 printf(
"<TD>%s%s%s%s%s%s%s%s",
87 ch[i].ctp & _MY_U ?
"U" :
"",
88 ch[i].ctp & _MY_L ?
"L" :
"",
89 ch[i].ctp & _MY_NMR ?
"N" :
"",
90 ch[i].ctp & _MY_SPC ?
"S" :
"",
91 ch[i].ctp & _MY_PNT ?
"P" :
"",
92 ch[i].ctp & _MY_CTR ?
"C" :
"",
93 ch[i].ctp & _MY_B ?
"B" :
"",
94 ch[i].ctp & _MY_X ?
"X" :
"");
96 if ((ch[i].uni >= 0x80) && (ch[i].uni <= 0x9F))
103 printf(
"<TD>ctrl<TD>ctrl<TD>ctrl");
107 printf(
"<TD>&#%d;",ch[i].uni);
108 printf(
"<TD>&#%d;",ch[i].low);
109 printf(
"<TD>&#%d;",ch[i].upp);
114 printf(
"</TABLE>\n");
115 printf(
"</PRE></BODY>\n");
119 static void print_index()
124 get_charset_by_name(
"",MYF(0));
126 printf(
"All charsets\n");
127 printf(
"<table border=1>\n");
128 printf(
"<tr bgcolor=EEEE99><th>ID<th>Charset<th>Collation<th>Def<th>Bin<th>Com<th>Comment\n");
129 for (cs=all_charsets ; cs < all_charsets+256; cs++)
133 printf(
"<tr bgcolor=#%s><td><a href=\"?%s\">%d</a><td>%s<td>%s<td>%s<td>%s<td>%s<td>%s\n",
134 (clr= !clr) ?
"DDDDDD" :
"EEEE99",
135 cs[0]->
name,cs[0]->number,cs[0]->csname,
137 (cs[0]->state & MY_CS_PRIMARY) ?
"def " :
" ",
138 (cs[0]->state & MY_CS_BINSORT) ?
"bin " :
" ",
139 (cs[0]->state & MY_CS_COMPILED) ?
"com " :
" ",
142 printf(
"</table>\n");
145 int main(
int argc,
char **argv) {
146 const char *the_set = NULL;
150 if (getenv(
"SCRIPT_NAME"))
152 printf(
"Content-Type: text/html\r\n\r\n");
156 if (argc > argcnt && argv[argcnt][0] ==
'-' && argv[argcnt][1] ==
'#')
158 DBUG_PUSH(argv[argcnt++]+2);
162 the_set = argv[argcnt++];
165 charsets_dir = argv[argcnt++];
173 if (!(cs= get_charset_by_name(the_set, MYF(MY_WME))))