Τετάρτη 25 Νοεμβρίου 2015

Χειρισμός κειμένων διαφορετικών γλωσσών (Μέρος Β)

Ένα μικρό πρόγραμμα (κάνει δυο εργασίες, ανάλογα την εισαγωγή), η μια δείχνει τα γράμματα από διάφορες γλώσσες στη σειρά που έχουν στην ANSI μορφή (στα 8bit ο χαρακτήρας), και η δεύτερη δείχνει τα νούμερα που πραγματικά αντιστοιχούν σε UNICODE μορφή (16bit ο κάθε χαρακτήρας, o τύπος λέγεται UTF16LE), για κάθε ένα σετ χαρακτήρων.
Ότι εμφανίζει στην οθόνη μπορει και να το τυπώνει η Μ2000. Δείτε παράδειγμα με προεπισκόπηση και εκτύπωση εδώ


\* Εμφάνιση σετ χαρακτήρων -ταυτόχρονα- στην Οθόνη
Οθόνη 5,0
Πένα 14
\\ βοηθητικές μεταβλητές η α και η β$
\\ 0 ή απλά Enter Για να δείξω αριθμούς, ή ένα αριθμό Για να δείξω γράμματα
α=0
Αν Ταύτιση("Α") Τότε { Διάβασε α : εντάξει=Αληθες } Αλλιώς {
      Δες εντάξει { Εισαγωγη "Δώσε ένα αρθμό Για να δείξω γράμματα:", α }
}
Γενική δείξε_χαρακτήρες = εντάξει Και α<>0
Αν δείξε_χαρακτήρες Τότε { Φόρμα 60,32 } Αλλιώς Φόρμα 80,32
Ανανέωση 100
Τμήμα ΔΕΙΞΕΜΟΥ {
      Διάβασε Όνομα_Χώρας$, Τοπικό_Κωδικός
      Τύπωσε Πάνω ~(12,4),Όνομα_Χώρας$,~(14)
      Τύπωσε Υπό
      Για I = 33 ΕΩΣ 255 {
            Αν δείξε_χαρακτήρες Τότε {
                  Τύπωσε ΧΑΡ$(i,Τοπικό_Κωδικός);
            } Αλλιώς {
                  Τύπωσε ΧΑΡΚΩΔ(ΧΑΡ$(I,Τοπικό_Κωδικός)),
            }
      }
      Τύπωσε
      Αν δείξε_χαρακτήρες Τότε Συνέχισε ' break the block but not the loop
      β$=Κομ$
      Οθόνη
}
ΔΕΙΞΕΜΟΥ "SYSTEM", 0
ΔΕΙΞΕΜΟΥ "GREEK", 1032
ΔΕΙΞΕΜΟΥ "HEBREW", 1037
ΔΕΙΞΕΜΟΥ "FINLAND", 2077
ΔΕΙΞΕΜΟΥ "TURKISH", 1055

Παρακάτω ειναι ένα παράδειγμα προγράμματος εργασίας:

DOCUMENT A$= {
Afrikaans - South Africa      0436      1078
Albanian - Albania      041c      1052
Alsatian      0484      1156
Amharic - Ethiopia      045e      1118
Arabic - Saudi Arabia      0401      1025
Arabic - Algeria      1401      5121
Arabic - Bahrain      3c01      15361
Arabic - Egypt      0c01      3073
Arabic - Iraq      0801      2049
Arabic - Jordan      2c01      11265
Arabic - Kuwait      3401      13313
Arabic - Lebanon      3001      12289
Arabic - Libya      1001      4097
Arabic - Morocco      1801      6145
Arabic - Oman      2001      8193
Arabic - Qatar      4001      16385
Arabic - Syria      2801      10241
Arabic - Tunisia      1c01      7169
Arabic - U.A.E.      3801      14337
Arabic - Yemen      2401      9217
Armenian - Armenia      042b      1067
Assamese      044d      1101
Azeri (Cyrillic)      082c      2092
Azeri (Latin)      042c      1068
Bashkir      046d      1133
Basque      042d      1069
Belarusian      0423      1059
Bengali (India)      0445      1093
Bengali (Bangladesh)      0845      2117
Bosnian (Bosnia/Herzegovina)      141A      5146
Breton      047e      1150
Bulgarian      0402      1026
Burmese      0455      1109
Catalan      0403      1027
Cherokee - United States      045c      1116
Chinese - People's Republic of China      0804      2052
Chinese - Singapore      1004      4100
Chinese - Taiwan      0404      1028
Chinese - Hong Kong SAR      0c04      3076
Chinese - Macao SAR      1404      5124
Corsican      0483      1155
Croatian      041a      1050
Croatian (Bosnia/Herzegovina)      101a      4122
Czech      0405      1029
Danish      0406      1030
Dari      048c      1164
Divehi      0465      1125
Dutch - Netherlands      0413      1043
Dutch - Belgium      0813      2067
Edo      0466      1126
English - United States      0409      1033
English - United Kingdom      0809      2057
English - Australia      0c09      3081
English - Belize      2809      10249
English - Canada      1009      4105
English - Caribbean      2409      9225
English - Hong Kong SAR      3c09      15369
English - India      4009      16393
English - Indonesia      3809      14345
English - Ireland      1809      6153
English - Jamaica      2009      8201
English - Malaysia      4409      17417
English - New Zealand      1409      5129
English - Philippines      3409      13321
English - Singapore      4809      18441
English - South Africa      1c09      7177
English - Trinidad      2c09      11273
English - Zimbabwe      3009      12297
Estonian      0425      1061
Faroese      0438      1080
Farsi      0429      1065
Filipino      0464      1124
Finnish      040b      1035
French - France      040c      1036
French - Belgium      080c      2060
French - Cameroon      2c0c      11276
French - Canada      0c0c      3084
French - Democratic Rep. of Congo      240c      9228
French - Cote d'Ivoire      300c      12300
French - Haiti      3c0c      15372
French - Luxembourg      140c      5132
French - Mali      340c      13324
French - Monaco      180c      6156
French - Morocco      380c      14348
French - North Africa      e40c      58380
French - Reunion      200c      8204
French - Senegal      280c      10252
French - Switzerland      100c      4108
French - West Indies      1c0c      7180
Frisian - Netherlands      0462      1122
Fulfulde - Nigeria      0467      1127
FYRO Macedonian      042f      1071
Galician      0456      1110
Georgian      0437      1079
German - Germany      0407      1031
German - Austria      0c07      3079
German - Liechtenstein      1407      5127
German - Luxembourg      1007      4103
German - Switzerland      0807      2055
Greek      0408      1032
Greenlandic      046f      1135
Guarani - Paraguay      0474      1140
Gujarati      0447      1095
Hausa - Nigeria      0468      1128
Hawaiian - United States      0475      1141
Hebrew      040d      1037
Hindi      0439      1081
Hungarian      040e      1038
Ibibio - Nigeria      0469      1129
Icelandic      040f      1039
Igbo - Nigeria      0470      1136
Indonesian      0421      1057
Inuktitut      045d      1117
Irish      083c      2108
Italian - Italy      0410      1040
Italian - Switzerland      0810      2064
Japanese      0411      1041
K'iche      0486      1158
Kannada      044b      1099
Kanuri - Nigeria      0471      1137
Kashmiri      0860      2144
Kashmiri (Arabic)      0460      1120
Kazakh      043f      1087
Khmer      0453      1107
Kinyarwanda      0487      1159
Konkani      0457      1111
Korean      0412      1042
Kyrgyz (Cyrillic)      0440      1088
Lao      0454      1108
Latin      0476      1142
Latvian      0426      1062
Lithuanian      0427      1063
Luxembourgish      046e      1134
Malay - Malaysia      043e      1086
Malay - Brunei Darussalam      083e      2110
Malayalam      044c      1100
Maltese      043a      1082
Manipuri      0458      1112
Maori - New Zealand      0481      1153
Mapudungun      0471      1146
Marathi      044e      1102
Mohawk      047c      1148
Mongolian (Cyrillic)      0450      1104
Mongolian (Mongolian)      0850      2128
Nepali      0461      1121
Nepali - India      0861      2145
Norwegian (Bokmål)      0414      1044
Norwegian (Nynorsk)      0814      2068
Occitan      0482      1154
Oriya      0448      1096
Oromo      0472      1138
Papiamentu      0479      1145
Pashto      0463      1123
Polish      0415      1045
Portuguese - Brazil      0416      1046
Portuguese - Portugal      0816      2070
Punjabi      0446      1094
Punjabi (Pakistan)      0846      2118
Quecha - Bolivia      046B      1131
Quecha - Ecuador      086B      2155
Quecha - Peru      0C6B      3179
Rhaeto-Romanic      0417      1047
Romanian      0418      1048
Romanian - Moldava      0818      2072
Russian      0419      1049
Russian - Moldava      0819      2073
Sami (Lappish)      043b      1083
Sanskrit      044f      1103
Scottish Gaelic      043c      1084
Sepedi      046c      1132
Serbian (Cyrillic)      0c1a      3098
Serbian (Latin)      081a      2074
Sindhi - India      0459      1113
Sindhi - Pakistan      0859      2137
Sinhalese - Sri Lanka      045b      1115
Slovak      041b      1051
Slovenian      0424      1060
Somali      0477      1143
Sorbian      042e      1070
Spanish - Spain (Modern Sort)      0c0a      3082
Spanish - Spain (Traditional Sort)      040a      1034
Spanish - Argentina      2c0a      11274
Spanish - Bolivia      400a      16394
Spanish - Chile      340a      13322
Spanish - Colombia      240a      9226
Spanish - Costa Rica      140a      5130
Spanish - Dominican Republic      1c0a      7178
Spanish - Ecuador      300a      12298
Spanish - El Salvador      440a      17418
Spanish - Guatemala      100a      4106
Spanish - Honduras      480a      18442
Spanish - Latin America      580a      22538
Spanish - Mexico      080a      2058
Spanish - Nicaragua      4c0a      19466
Spanish - Panama      180a      6154
Spanish - Paraguay      3c0a      15370
Spanish - Peru      280a      10250
Spanish - Puerto Rico      500a      20490
Spanish - United States      540a      21514
Spanish - Uruguay      380a      14346
Spanish - Venezuela      200a      8202
Sutu      0430      1072
Swahili      0441      1089
Swedish      041d      1053
Swedish - Finland      081d      2077
Syriac      045a      1114
Tajik      0428      1064
Tamazight (Arabic)      045f      1119
Tamazight (Latin)      085f      2143
Tamil      0449      1097
Tatar      0444      1092
Telugu      044a      1098
Thai      041e      1054
Tibetan - Bhutan      0851      2129
Tibetan - People's Republic of China      0451      1105
Tigrigna - Eritrea      0873      2163
Tigrigna - Ethiopia      0473      1139
Tsonga      0431      1073
Tswana      0432      1074
Turkish      041f      1055
Turkmen      0442      1090
Uighur - China      0480      1152
Ukrainian      0422      1058
Urdu      0420      1056
Urdu - India      0820      2080
Uzbek (Cyrillic)      0843      2115
Uzbek (Latin)      0443      1091
Venda      0433      1075
Vietnamese      042a      1066
Welsh      0452      1106
Wolof      0488      1160
Xhosa      0434      1076
Yakut      0485      1157
Yi      0478      1144
Yiddish      043d      1085
Yoruba      046a      1130
Zulu      0435      1077
HID (Human Interface Device)      04ff      1279}
B$=REPLACE$("      ",CHR$(34)+","+CHR$(34), A$)
B$="PRINT"+CHR$(34)+REPLACE$(CHR$(13)+CHR$(10), CHR$(34)+CHR$(13)+CHR$(10)+"DATA "+CHR$(34), B$)+CHR$(34)
INLINE B$
DATA "","",""
DOCUMENT CR$={
}
CLEAR A$
REPEAT {
READ BB$, CC$, DD$
IF BB$<>"" THEN A$= "DATA "+QUOTE$(BB$)+","+DD$+CR$
} UNTIL BB$=""
INLINE "TEXT LOCALE.TXT {"+A$+"}"
WIN TEMPORARY$+"LOCALE.TXT"

Όταν τρέξει εξάγει αυτό στο αρχείο και μας το δείχνει (προσοχή τα προσωρινά αρχεία τα σβήνει η Μ2000 όταν τερματίσει):
Για την εντολή  DATA ή ΣΕΙΡΑ δείτε εδώ στα βασικά

DATA "Afrikaans - South Africa",1078
DATA "Albanian - Albania",1052
DATA "Alsatian",1156
DATA "Amharic - Ethiopia",1118
DATA "Arabic - Saudi Arabia",1025
DATA "Arabic - Algeria",5121
DATA "Arabic - Bahrain",15361
DATA "Arabic - Egypt",3073
DATA "Arabic - Iraq",2049
DATA "Arabic - Jordan",11265
DATA "Arabic - Kuwait",13313
DATA "Arabic - Lebanon",12289
DATA "Arabic - Libya",4097
DATA "Arabic - Morocco",6145
DATA "Arabic - Oman",8193
DATA "Arabic - Qatar",16385
DATA "Arabic - Syria",10241
DATA "Arabic - Tunisia",7169
DATA "Arabic - U.A.E.",14337
DATA "Arabic - Yemen",9217
DATA "Armenian - Armenia",1067
DATA "Assamese",1101
DATA "Azeri (Cyrillic)",2092
DATA "Azeri (Latin)",1068
DATA "Bashkir",1133
DATA "Basque",1069
DATA "Belarusian",1059
DATA "Bengali (India)",1093
DATA "Bengali (Bangladesh)",2117
DATA "Bosnian (Bosnia/Herzegovina)",5146
DATA "Breton",1150
DATA "Bulgarian",1026
DATA "Burmese",1109
DATA "Catalan",1027
DATA "Cherokee - United States",1116
DATA "Chinese - People's Republic of China",2052
DATA "Chinese - Singapore",4100
DATA "Chinese - Taiwan",1028
DATA "Chinese - Hong Kong SAR",3076
DATA "Chinese - Macao SAR",5124
DATA "Corsican",1155
DATA "Croatian",1050
DATA "Croatian (Bosnia/Herzegovina)",4122
DATA "Czech",1029
DATA "Danish",1030
DATA "Dari",1164
DATA "Divehi",1125
DATA "Dutch - Netherlands",1043
DATA "Dutch - Belgium",2067
DATA "Edo",1126
DATA "English - United States",1033
DATA "English - United Kingdom",2057
DATA "English - Australia",3081
DATA "English - Belize",10249
DATA "English - Canada",4105
DATA "English - Caribbean",9225
DATA "English - Hong Kong SAR",15369
DATA "English - India",16393
DATA "English - Indonesia",14345
DATA "English - Ireland",6153
DATA "English - Jamaica",8201
DATA "English - Malaysia",17417
DATA "English - New Zealand",5129
DATA "English - Philippines",13321
DATA "English - Singapore",18441
DATA "English - South Africa",7177
DATA "English - Trinidad",11273
DATA "English - Zimbabwe",12297
DATA "Estonian",1061
DATA "Faroese",1080
DATA "Farsi",1065
DATA "Filipino",1124
DATA "Finnish",1035
DATA "French - France",1036
DATA "French - Belgium",2060
DATA "French - Cameroon",11276
DATA "French - Canada",3084
DATA "French - Democratic Rep. of Congo",9228
DATA "French - Cote d'Ivoire",12300
DATA "French - Haiti",15372
DATA "French - Luxembourg",5132
DATA "French - Mali",13324
DATA "French - Monaco",6156
DATA "French - Morocco",14348
DATA "French - North Africa",58380
DATA "French - Reunion",8204
DATA "French - Senegal",10252
DATA "French - Switzerland",4108
DATA "French - West Indies",7180
DATA "Frisian - Netherlands",1122
DATA "Fulfulde - Nigeria",1127
DATA "FYRO Macedonian",1071
DATA "Galician",1110
DATA "Georgian",1079
DATA "German - Germany",1031
DATA "German - Austria",3079
DATA "German - Liechtenstein",5127
DATA "German - Luxembourg",4103
DATA "German - Switzerland",2055
DATA "Greek",1032
DATA "Greenlandic",1135
DATA "Guarani - Paraguay",1140
DATA "Gujarati",1095
DATA "Hausa - Nigeria",1128
DATA "Hawaiian - United States",1141
DATA "Hebrew",1037
DATA "Hindi",1081
DATA "Hungarian",1038
DATA "Ibibio - Nigeria",1129
DATA "Icelandic",1039
DATA "Igbo - Nigeria",1136
DATA "Indonesian",1057
DATA "Inuktitut",1117
DATA "Irish",2108
DATA "Italian - Italy",1040
DATA "Italian - Switzerland",2064
DATA "Japanese",1041
DATA "K'iche",1158
DATA "Kannada",1099
DATA "Kanuri - Nigeria",1137
DATA "Kashmiri",2144
DATA "Kashmiri (Arabic)",1120
DATA "Kazakh",1087
DATA "Khmer",1107
DATA "Kinyarwanda",1159
DATA "Konkani",1111
DATA "Korean",1042
DATA "Kyrgyz (Cyrillic)",1088
DATA "Lao",1108
DATA "Latin",1142
DATA "Latvian",1062
DATA "Lithuanian",1063
DATA "Luxembourgish",1134
DATA "Malay - Malaysia",1086
DATA "Malay - Brunei Darussalam",2110
DATA "Malayalam",1100
DATA "Maltese",1082
DATA "Manipuri",1112
DATA "Maori - New Zealand",1153
DATA "Mapudungun",1146
DATA "Marathi",1102
DATA "Mohawk",1148
DATA "Mongolian (Cyrillic)",1104
DATA "Mongolian (Mongolian)",2128
DATA "Nepali",1121
DATA "Nepali - India",2145
DATA "Norwegian (Bokmal)",1044
DATA "Norwegian (Nynorsk)",2068
DATA "Occitan",1154
DATA "Oriya",1096
DATA "Oromo",1138
DATA "Papiamentu",1145
DATA "Pashto",1123
DATA "Polish",1045
DATA "Portuguese - Brazil",1046
DATA "Portuguese - Portugal",2070
DATA "Punjabi",1094
DATA "Punjabi (Pakistan)",2118
DATA "Quecha - Bolivia",1131
DATA "Quecha - Ecuador",2155
DATA "Quecha - Peru",3179
DATA "Rhaeto-Romanic",1047
DATA "Romanian",1048
DATA "Romanian - Moldava",2072
DATA "Russian",1049
DATA "Russian - Moldava",2073
DATA "Sami (Lappish)",1083
DATA "Sanskrit",1103
DATA "Scottish Gaelic",1084
DATA "Sepedi",1132
DATA "Serbian (Cyrillic)",3098
DATA "Serbian (Latin)",2074
DATA "Sindhi - India",1113
DATA "Sindhi - Pakistan",2137
DATA "Sinhalese - Sri Lanka",1115
DATA "Slovak",1051
DATA "Slovenian",1060
DATA "Somali",1143
DATA "Sorbian",1070
DATA "Spanish - Spain (Modern Sort)",3082
DATA "Spanish - Spain (Traditional Sort)",1034
DATA "Spanish - Argentina",11274
DATA "Spanish - Bolivia",16394
DATA "Spanish - Chile",13322
DATA "Spanish - Colombia",9226
DATA "Spanish - Costa Rica",5130
DATA "Spanish - Dominican Republic",7178
DATA "Spanish - Ecuador",12298
DATA "Spanish - El Salvador",17418
DATA "Spanish - Guatemala",4106
DATA "Spanish - Honduras",18442
DATA "Spanish - Latin America",22538
DATA "Spanish - Mexico",2058
DATA "Spanish - Nicaragua",19466
DATA "Spanish - Panama",6154
DATA "Spanish - Paraguay",15370
DATA "Spanish - Peru",10250
DATA "Spanish - Puerto Rico",20490
DATA "Spanish - United States",21514
DATA "Spanish - Uruguay",14346
DATA "Spanish - Venezuela",8202
DATA "Sutu",1072
DATA "Swahili",1089
DATA "Swedish",1053
DATA "Swedish - Finland",2077
DATA "Syriac",1114
DATA "Tajik",1064
DATA "Tamazight (Arabic)",1119
DATA "Tamazight (Latin)",2143
DATA "Tamil",1097
DATA "Tatar",1092
DATA "Telugu",1098
DATA "Thai",1054
DATA "Tibetan - Bhutan",2129
DATA "Tibetan - People's Republic of China",1105
DATA "Tigrigna - Eritrea",2163
DATA "Tigrigna - Ethiopia",1139
DATA "Tsonga",1073
DATA "Tswana",1074
DATA "Turkish",1055
DATA "Turkmen",1090
DATA "Uighur - China",1152
DATA "Ukrainian",1058
DATA "Urdu",1056
DATA "Urdu - India",2080
DATA "Uzbek (Cyrillic)",2115
DATA "Uzbek (Latin)",1091
DATA "Venda",1075
DATA "Vietnamese",1066
DATA "Welsh",1106
DATA "Wolof",1160
DATA "Xhosa",1076
DATA "Yakut",1157
DATA "Yi",1144
DATA "Yiddish",1085
DATA "Yoruba",1130
DATA "Zulu",1077
DATA "HID (Human Interface Device)",1279




Δεν υπάρχουν σχόλια:

Δημοσίευση σχολίου

You can feel free to write any suggestion, or idea on the subject.