#!/usr/bin/perl -p

# ¥»µ{¦¡¬O¥Î¨Ó¹ï debian-zh-faq ÁcÅé¤¤¤åª©§@¥Xªº¡uµ½«á³B²z¡v¡C
#
# §@ªÌ¡GÀNªFÆF Anthony Fok <foka@debian.org>

next if /^%/;

1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*)¡§/$1¡u/);
1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*)¡¨/$1¡v/);
1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*)¸Ì/$1ùØ/);

# Â² -> Ác
1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*)­S¨Ò/$1½d¨Ò/);
1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*(¨å|³W))­S/$1½d/);
1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*(Ãö|²×))¤_/$1©ó/);
1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*)´_¨î/$1½Æ»s/);


    s/¾Þ§@¨t²Î/§@·~¨t²Î/g;
    s/¤å¥»¤å¥ó/¯Â¤å¦rÀÉ/g;
    s/¤å¦r³B²z/¤å®Ñ³B²z/g;
#    1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*)¤å¥»/$1¤å¦r/);
    s/¤å¥»(?=¼Ò¦¡|½s¿è|®æ¦¡)/¤å¦r/g;
    s/¤å¥óºÞ²z¾¹/ÀÉ®×ºÞ²z­û/g;
    s/¤å¥ó¨t²Î/ÀÉ®×¨t²Î/g;
    s/ªA°È¾¹/¦øªA¾¹/g;

s/§Y´¡§Y¥Î/ÀH´¡§Y¥Î/g;
s/µ¡¤f¨t²Î/µøµ¡¨t²Î/g;
s/X~µ¡¤f/X~µøµ¡/g;
1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*)µ¡¤f/$1µøµ¡/);


# hashao §â "server" ¥s§@ "ªA¨Í¾¹" ¡K¡K
s/ªA¨Í¾¹/¦øªA¾¹/g;

# Riser §â "server" ¥s§@ "ªA°Èµ{§Ç" ¡K¡K
s/ªA°Èµ{§Ç/¦øªA¾¹/g;

1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*)­pºâ¾÷/$1¹q¸£/);
1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*)¤º®Ö/$1®Ö¤ß/);
1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*)¤A¤Ó(?=ºô)/$1¥H¤Ó/);
1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*)¦rÅé/$1¦r«¬/);
1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*)«á¥x/$1­I´º/);
1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*)µæ³æ/$1¿ï³æ/);
1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*)«Ì¹õ/$1¿Ã¹õ/);
1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*)¥ú¼Ð/$1´å¼Ð/);
1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*)¹«¼Ð/$1·Æ¹«/);
1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*)¸}¥»/$1½Z¥»/);
1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*)ºôµ¸/$1ºô¸ô/);
1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*)¤¬Ápºô/$1ºô»Úºô¸ô/);

    s/³n¥ó¥](?!¸Ë|¬A)/®M¥ó/g;
    1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*(³n|µw))¥ó/$1Åé/);
    1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*(³n|µw|¥ú|ºÏ|Zip~))½L/$1ºÐ/);
    1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*)·½(¥N)?½X/$1­ì©l½X/);

# zh_HK --> zh_TW
    1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*)ºÏºÐ/$1ºÏ¤ù/);


s/\<t\<(.+?)\>\>/$1/g;

s/\<s\<¤åÀÉ\>\>/¤å¥ó/g;
s/\<s\<¤å¥ó\>\>/ÀÉ®×/g;
s/\<s\<ÀÉ®×\>\>/ÀÉ®×®w/g;
s/\<s\<¤å¥ó¦W\>\>/ÀÉ®×¦WºÙ/g;
s/\<s\<°t¸m¤å¥ó\>\>/³]©wÀÉ/g;
s/\<s\<°t¸m\>\>/³]©w/g;
s/\<s\<µ{§Ç\>\>/µ{¦¡/g;
s/«È¤áµ{§Ç/«È¤áµ{¦¡/g;
s/\<s\<¼Æ¾Ú\>\>/¸ê®Æ/g;
s/\<s\<«H®§\>\>/¸ê°T/g;
s/\<s\<Àq»{\>\>/¹w³]/g;
s/\<s\<¯Ê¬Ù\>\>/¹w³]/g;
s/\<s\<ºôÃö\>\>/¹h¹D/g;
s/\<s\<¤Þ¾É\>\>/±Ò°Ê/g;
s/\<s\<¤º¦s\>\>/°O¾ÐÅé/g;
s/\<s\<¤ä«ù\>\>/¤ä´©/g;
s/\<s\<¥´¦L\>\>/¦C¦L/g;
s/\<s\<¥´¦L¾÷\>\>/¦Cªí¾÷/g;
s/\<s\<¹B¦æ\>\>/°õ¦æ/g;
s/\<s\<¥]\>\>/®M¥ó/g;
s/\<s\<ª`\>\>/µù/g;
s/\<s\<¤â¤u\>\>/¤â°Ê/g;

    s/«æ±Ï½L/«æ±ÏºÏºÐ/g;
    s/À³«æ½L/«æ±ÏºÏºÐ/g;
    s/±Ò°Ê½L/±Ò°ÊºÏºÐ/g;
    s/¤Þ¾É½L/±Ò°ÊºÏºÐ/g;

# µ²§ô


sub changewww () {
    s|^(<HTML lang="zh)">|$1-TW">|;
    s/(\.zh)(?=\.(?:gif|jpg|png))/$1-tw/g;
    s|^<A href=".*">(¤¤¤å&nbsp;\(Big5\))</A>(?=&nbsp;)|$1|;

    s/µ¡¤f¨t²Î/µøµ¡¨t²Î/g;
    s/¶l(»¼|¥ó)¦Cªí/³q«H½×¾Â/g;
    s/Ãè¹³((ºô)?¯¸)/¬M®g$1/g;
    s/ºôµ¸¹ï¶H¼Ò«¬Àô¹Ò/ºôµ¸ª«¥ó¼Ò«¬Àô¹Ò/g;
}
