diff --git a/mysys/charset2html.c b/mysys/charset2html.c
index 3da24232ad4..c6112bfeb9e 100644
--- a/mysys/charset2html.c
+++ b/mysys/charset2html.c
@@ -64,7 +64,7 @@ static void print_cs(CHARSET_INFO *cs)
for (i=0; i<256; i++)
{
ch[i].cod=i;
- ch[i].srt=cs->sort_order[i];
+ ch[i].srt=cs->sort_order ? cs->sort_order[i] : i;
ch[i].uni=cs->tab_to_uni[i];
ch[i].low=cs->tab_to_uni[cs->to_lower[i]];
ch[i].upp=cs->tab_to_uni[cs->to_upper[i]];
@@ -104,12 +104,41 @@ static void print_cs(CHARSET_INFO *cs)
printf("