#!/bin/sh #
(
echo "DROP TABLE lang;"
echo "CREATE TABLE lang (lang varchar(128), letters text character set utf8);"
(
grep -v "^#" << END
#
Greenlandic	ÁÂÃÊÍÎÔÚÛáâãêíîôúûĨĩĸŨũ
#Use of these letters was abolished in a spelling reform in 1973:
#Greenlandic	ÅÆØåæø
#Characters not found in the UCS:
#	K LATIN CAPITAL LETTER KRA
#############################################################
#Basque	ÑÜñüŔŕ
#Characters not found in the UCS:
#	D LATIN CAPITAL LETTER D WITH MACRON
#	d LATIN SMALL LETTER D WITH MACRON
#	L LATIN CAPITAL LETTER L WITH MACRON
#	l LATIN SMALL LETTER L WITH MACRON
#	T LATIN CAPITAL LETTER T WITH MACRON
#	t LATIN SMALL LETTER T WITH MACRON
#############################################################
#Maltese	#ÀÁÂÈÉÊÌÍÎÒÓÔÙÚÛ#àáâèéêìíîòÓôùúû#ĊċĠġĦħŻżʼ
#BosnianCyr	ЂЈЉЊЋЏАБВГДЕЖЗИКЛМНОПРСТУФХЦЧШабвгдежзиклмнопрстуфхцчшђјљњћџ
#Scots	A
#Scots1	ƷȜȝʒ
###########################################
#### Hiragana 3040-309F
Hiragana	ぁあぃいぅうぇえぉおかがきぎくぐけげこごさざしじすずせぜそぞただちぢっつづてでとどなにぬねのはばぱひびぴふぶぷへべぺほぼぽまみむめもゃやゅゆょよらりるれろゎわゐゑをん
Hiragana1	ゔ゙゚
Hiragana2	゛゜ゝゞ
#### Katakana 30A0-30FF
Katakana	ァアィイゥウェエォオカガキギクグケゲコゴサザシジスズセゼソゾタダチヂッツヅテデトドナニヌネノハバパヒビピフブプヘベペホボポマミムメモャヤュユョヨラリルレロヮワヰヱヲンヴヵヶ
Katakana1	ヷヸヹヺ
Katakana2	・ーヽヾ
############################################
Albanian	ÂÇËâçë
Bosnian	ĆćČčĐ𩹮ž
Breton	ÂÊÑÙÜâêñùü
Catalan	ÀÇÈÉÍÏÒÓÚÜàçèéíïòóúü
#Catalan1	·Ŀŀ
Croatian	ĆćČčĐ𩹮ž
CroatianLig	DZDzdzDŽDždžLJLjljNJNjnj
Czech	ÁÉÍÓÚÝáéíóúýČčĎďĚěŇňŘřŠšŤťŮůŽž
Danish	ÁÄÅÆÉÓÖØÜáäåæéóöøü
Dutch	ÀÂÄÆÇÈÉÊËÎÏÑÒÓÔÖÙÚÛÜàâäæçèéêëîïñòóôöùúûü
Esperanto	ĈĉĜĝĤĥĴĵŜŝŬŭ
Estonian	ÄÕÖÜäõöüŠšŽž
Faroese	ÅÆÐÓÖØÚÝåæðóöøúý
Finnish	ÄÅÖÜäåöü
#Finnish1	ŠšŽž
French(limited)	ÀÂÆÇÈÉÊËÎÏÑÔÙÛàâæçèéêëîïñôùûÿ
French	ŒœŸ
German	ÄÖÜßäöü
Hungarian	ÁÉÍÓÖÚÜáéíóöúüŐőŰű
Icelandic	ÁÆÉÍÐÓÖÚÝÞáæéíðóöúýþ
Italian	ÀÈÉÌÍÏÒÓÙÚàèéìíïòóùú
#Latin	A
Latvian	ĀāČčĒēĢģĪīĶķĻļŅņŠšŪūŽž
Lithuanian	ĄąČčĖėĘęĮįŠšŪūŲųŽž
Norwegian	ÅÆØåæø
Polish	ÓóĄąĆćĘꣳŃńŚśŹźŻż
Portuguese	ÀÁÂÃÇÉÊÍÓÔÕÚÜàáâãçéêíóôõúü
#http://en.wikipedia.org/wiki/Special_Romanian_Unicode_characters
Romanian	ÂÎâîĂăȘșȚț
Romanian(ErrorST)	ÂÎâîĂ㪺Ţţ
Slovak	ÁÄÉÍÓÔÚÝáäéíóôúýČčĎďĹ弾ŇňŔ੹ŤťŽž
Slovene	Č芚Žž
Sorbian-Lower	ĆćČčĚ죳ŃńŘřŚśŠšŹźŽž
Sorbian-Upper	ÓóĆćČčĚ죳ŃńŘřŠšŽž
Spanish	ÁÉÍÑÓÚÜáéíñóúü
Swedish	ÄÅÖäåö
Turkish	ÂÇÖÛÜâçöûüĞğİı
Welsh	ÀÁÂÄÈÉÊËÌÍÎÏÒÓÔÖÙÚÛÜÝàáâäèéêëìíîïòóôöùúûüýÿŴŵŶŷŸẀẁẂẃẄẅỲỳ
##################################
Belarusian	ЁІЎАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюяёіў
Bulgarian	АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЬЮЯабвгдежзийклмнопрстуфхцчшщъьюя
Bulgarian1	ЀҭѐѝѢѣѪѫ
Macedonian	ЃЅЈЉЊЌЏАБВГДЕЖЗИКЛМНОПРСТУФХЦЧШабвгдежзиклмнопрстуфхцчшѓѕјљњќџ
Russian	ЁАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюяё
RussianOLD	ІіѢѣѲѳѴѵ
Serbian	ЂЈЉЊЋЏАБВГДЕЖЗИКЛМНОПРСТУФХЦЧШабвгдежзиклмнопрстуфхцчшђјљњћџ
Ukrainian	ЄІЇАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЬЭЮЯабвгдежзийклмнопрстуфхцчшщьэюяєіїҐґ
##################################
Armenian	ԱԲԳԴԵԶԷԸԹԺԻԼԽԾԿՁՂՃՄՅՆՇՈՉՊՋՌՍՎՏՑՒՓՔՕՖ՛՜՝՞՟աբգդեֆ։
#Armenian1	՚֊
#Characters not found in the UCS:
#	ARMENIAN ETERNITY SIGN
#
GeorgianOld	ႠႡႢႣႤႥႦႧႨႩႪႫႬႭႮႯႰႱႲႳႴႵႶႷႸႹႺႻႼႽႾႿჀჁჂჃჄჅ
Georgian	აბგდევზთიკლმნოპჟრსტუფქღყშჩცძწჭხჯჰ
GeorgianArc	ჱჲჳჴჵჶ
GeorgianPunc	჻
#
GreekExt1	΄΅Ά·ΈΉΊ»Ό½ΎΏΐ
Greek	ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩαβγδεζηθικλμνξοπρστυφχψω
GreekExt2	ΪΫάέήίΰϊϋόύώ
GreekExt4	ς
#
Hebrew	אבגדהוזחטיךכלםמןנסעףפץצקרשת
##################################
#Abaza
#Abkhaz
#Adyghe
#Agul *
#(Aisor)
#Akhvakh *
#(?lvdalska)
#(Andi) *
#(Aragonese)
#Archi *
#Arumanian
#(Arvanite)
#Asturian
#Avar
#Azerbaijani
#(Bagulal) *
#Balkar
#Bashkir
#Basque			!
#Bats *
#Bezhta *
#(Botlikh) *
#Budukh *
#(Chamalal)
#Chechen
#Chuvash
#Cornish		!
#(Corsican)
#Dargwa
#Erzya
#(Franco-Proven?al)
#(Frisian, East)
#(Frisian, North)
#Frisian, West
#Friulian
#Gagauz
#Gaelic, Irish		!
#Gaelic, Manx		!
#Gaelic, Scottish	!
#Galician		!
#(German, Low)		!
#(German, Swiss)	!
#Godoberi *
#(Hinukh) *
#(Hunzib) *
#Ingrian
#Ingush
#Istro-Romanian
#(Judeo-Georgian)
#(Judeo-Kurdish)
#(Judeo-Tati)
#Kabardian
#Kalmyk
#Karachay
#(Karaim)
#(Karata) *
#Karelian
#Kashubian
#Kazakh
#Khinalug
#(Khvarshi) *
#(Kirmanji)
#Komi
#Komi-Permyak
#(Kryts)
#Kumyk
#(Kurdish)
#(Ladin)
#(Ladino)
#Lak
#Laz
#Lezgian
#Livonian
#(Ludian)
#Luxemburgish		!
#Mari, Hill
#Mari, Meadow
#Megleno-Romanian
#(Mingrelian)
#Moksha
#Moldavian
#Nenets, Tundra
#Nogai
#Occitan
#Old Church Slavonic
#(Olonets)
#Ossetian
#(Romani)
#Romansch
#(Rusyn)
#Rutul
#Sami, Inari
#Sami, Kildin
#Sami, Lule
#Sami, Northern
#Sami, Skolt
#Sami, Southern
#(Sami, Ter) *
#(Sami, Ume) *
#(Sardinian) *
#Scots			!
#Svan
#Tabasaran
#(Talysh)
#Tatar, Crimean
#Tatar, Kazan
#Tati
#(Tindi) *
#(Tsakonian) *
#Tsakhur *
#(Tsez) *
#(Turkish, Crimean)
#Ubykh *
#Udi
#Udmurt
#(V?mhusm?l)
#Vepsian
#Votic
#(Walloon)
#(Yiddish) 
################################
#      4	Gaelic-new-orthography
#      4	Frisian
#      3	Rhaeto-Romanic
#      2	S&AACUTEmi-with-restrictions
#      1	Rhjaeto-Romanic
#      1	Gaelic-old-and-new-orthographies
END
) | 

while read a b
do
  c=`echo $b | replace "&#x" "" ";" ""`
  printf "INSERT INTO lang VALUES ('$a',_ucs2 X'$c');\n"
done
) | mysql -f test

#mysql test << END
#SELECT * FROM lang WHERE CONVERT(letters USING latin1) NOT LIKE _binary'%?%';
#SELECT * FROM lang WHERE CONVERT(letters USING latin2) NOT LIKE _binary'%?%';
#END



list="big5 dec8 cp850 hp8 koi8r latin1 latin2 swe7 ascii ujis sjis hebrew euckr koi8u gb2312 greek cp1250 gbk latin5 armscii8 cp866 keybcs2 macce macroman cp852 latin7 cp1251 cp1256 cp1257 geostd8"

for p in $list
do
echo "-----------------"
echo $p:
mysql  -sss test << END
SELECT lang FROM lang WHERE CONVERT(letters USING $p) NOT LIKE _binary'%?%' ORDER BY lang;
END
done