Jump to content

Module:Ccnorm

From Wikipedia, the free encyclopedia

local p = {}

function p.ccnorm(frame)
   local rv= mw.ustring.toNFC (frame.args[1])

        rv = mw.ustring.gsub(rv,"[ంಂം00०০੦૦୦௦౦೦๐໐၀᠐〇]","0")
        rv = mw.ustring.gsub(rv,"[٠۰]","٠")
        rv = mw.ustring.gsub(rv,"[OOooΘΟοОоՕօⵔഠဝ]","0")
        rv = mw.ustring.gsub(rv,"[١۱]","١")
        rv = mw.ustring.gsub(rv,"[౧೧]","౧")
        rv = mw.ustring.gsub(rv,"[|11IiIiıɨƗɩƖlLLlłŁƚɫɭǀιΙІіӀᎥᏞ丨]","1")
        rv = mw.ustring.gsub(rv,"[22]","2")
        rv = mw.ustring.gsub(rv,"[٢۲]","٢")
        rv = mw.ustring.gsub(rv,"[२૨]","२")
        rv = mw.ustring.gsub(rv,"[౨೨]","౨")
        rv = mw.ustring.gsub(rv,"[ƧƨϩϨᒿ]","2")
        rv = mw.ustring.gsub(rv,"[٣۳]","٣")
        rv = mw.ustring.gsub(rv,"[३૩]","३")
        rv = mw.ustring.gsub(rv,"[४૪]","४")
        rv = mw.ustring.gsub(rv,"[55sSsSʂƼƽЅѕᏕᏚ]","5")
        rv = mw.ustring.gsub(rv,"[77]","7")
        rv = mw.ustring.gsub(rv,"[٧۷]","٧")
        rv = mw.ustring.gsub(rv,"[ଃ৪੪88]","8")
        rv = mw.ustring.gsub(rv,"[٨۸]","٨")
        rv = mw.ustring.gsub(rv,"[८૮]","८")
        rv = mw.ustring.gsub(rv,"[Ȣȣ]","8")
        rv = mw.ustring.gsub(rv,"[੧୨৭99]","9")
        rv = mw.ustring.gsub(rv,"[౯೯]","౯")
        rv = mw.ustring.gsub(rv,"[44٩۹aaAAáàăắằẵẳâấầẫẩåǻäǟãǡąāảȁạặậḁæɑαΑἄᾄἂᾂἆᾆᾀἁἅᾅἃᾃἇᾇᾁάὰᾳАаᎪᏎᗅ]","A")
        rv = mw.ustring.gsub(rv,"[ÆӔӕ]","Æ")
        rv = mw.ustring.gsub(rv,"[฿BbbBʙƀƁɓƂƃßƄƅΒβбВвЪъьЬҌҍѣѢᏏᏴᖯᗷ]","B")
        rv = mw.ustring.gsub(rv,"[¢ccCCćĉčċçƇƈʃςϲϹсСҫҪᏟ]","C")
        rv = mw.ustring.gsub(rv,"[dDⅆdDďḍĐđðÐƉɖɗƊƋƌԁԀᑯᗞᗪ]","D")
        rv = mw.ustring.gsub(rv,"[DZdz]","DZ")
        rv = mw.ustring.gsub(rv,"[dž]","dz")
        rv = mw.ustring.gsub(rv,"[DŽ]","DZ")
        rv = mw.ustring.gsub(rv,"[33eEeEéèĕếềễểěëẽėȩȨḝęēḗẻȅȇẹệḙḛəɛƐɜʒƷȜȝΕεҘҙЕеєЄзЗӡӠჳՅعڠⴹᎬ]","E")
        rv = mw.ustring.gsub(rv,"[ǝƏɘɚәӘ]","ǝ")
        rv = mw.ustring.gsub(rv,"[₣FfFfƑƒϜϝғҒᖴ]","F")
        rv = mw.ustring.gsub(rv,"[66GGggǵğĝǧġģḡɡɢǥǤɠƓБԌԍցᏀᏳ]","G")
        rv = mw.ustring.gsub(rv,"[hHʰHhĥȞḧḣḩḥḫħĦʜɦʱⱧΗηἠἤἢἦᾐἡἥἣἧήὴнНӊӉҢңӈӇњԋћЋһҺհᎻᏂᏲᕼ]","H")
        rv = mw.ustring.gsub(rv,"[ijIJ]","IJ")
        rv = mw.ustring.gsub(rv,"[JJjjϳЈјյᎫᏧᒍ]","J")
        rv = mw.ustring.gsub(rv,"[kKkKķƙƘĸκΚкКҚқӄҡҞҟҝќᏦ]","K")
        rv = mw.ustring.gsub(rv,"[ŀĿ]","Ŀ")
        rv = mw.ustring.gsub(rv,"[LJlj]","LJ")
        rv = mw.ustring.gsub(rv,"[₥mmMMḿṁṃɱɯμΜмМӎӍᎷᗰ]","M")
        rv = mw.ustring.gsub(rv,"[₦nnNNńňñņŅṇɲƝȠɳνΝոռ]","N")
        rv = mw.ustring.gsub(rv,"[njNJ]","NJ")
        rv = mw.ustring.gsub(rv,"[ØøǾǿ]","Ø")
        rv = mw.ustring.gsub(rv,"[Ơơ]","Ơ")
        rv = mw.ustring.gsub(rv,"[œŒ]","Œ")
        rv = mw.ustring.gsub(rv,"[ƟɵθϴӨөѲѳⴱᎾ]","Ɵ")
        rv = mw.ustring.gsub(rv,"[₧ppPPṕṗƥƤþǷƿρΡРрքᏢᑭ]","P")
        rv = mw.ustring.gsub(rv,"[ɸϕΦφФф]","ɸ")
        rv = mw.ustring.gsub(rv,"[qQqQʠɊգԳզ]","Q")
        rv = mw.ustring.gsub(rv,"[®rRrʳRŕřṙŗȑȓṛṝṟʀƦʴʵɼɽʶΓГгяᎡᎱᏒᖇ]","R")
        rv = mw.ustring.gsub(rv,"[tTtTťţṭțȚ]","T")
        rv = mw.ustring.gsub(rv,"[Ţ]","Ţ")
        rv = mw.ustring.gsub(rv,"[ŦŧƫƭƬʈƮτΤТтҬҭ]","T")
        rv = mw.ustring.gsub(rv,"[℧uUuUúùŭûǔůüǘǜǚǖűũųūƱʋƲцԱՄսՍᘴ]","U")
        rv = mw.ustring.gsub(rv,"[vVVvѵѴᏙᐯ]","V")
        rv = mw.ustring.gsub(rv,"[₩WWwwẃẁŵẅẇẉωᎳᏔᗯ]","W")
        rv = mw.ustring.gsub(rv,"[᙮᙭xXXxχΧХхҲҳᕁᕽ]","X")
        rv = mw.ustring.gsub(rv,"[ʊYYyyʸýỳŷÿỹẏȲỷỵƴƳΥϒυὑὕὓὗϓύὺῠϋῡУуүҮұҰҷҶӌӋყᎩᎽ]","Y")
        rv = mw.ustring.gsub(rv,"[ZZzzźžżƶƵȥȤʐΖᏃ]","Z")
   
   return rv
end


return p