mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-29 02:03:42 +02:00
LazUtils: Support KOI8-R, KOI8-U and KOI8-RU codepages in LConvEncoding. Issue #37155, patch from eastorwest.
git-svn-id: trunk@63354 -
This commit is contained in:
parent
1ac05df5e7
commit
2013a99dc3
@ -4416,7 +4416,7 @@ const
|
||||
#195#191 // #255
|
||||
);
|
||||
|
||||
ArrayKOI8ToUTF8: TCharToUTF8Table = (
|
||||
ArrayKOI8RToUTF8: TCharToUTF8Table = (
|
||||
#0, // #0
|
||||
#1, // #1
|
||||
#2, // #2
|
||||
@ -4545,70 +4545,71 @@ const
|
||||
'}', // '}'
|
||||
'~', // '~'
|
||||
#127, // #127
|
||||
'', // #128
|
||||
'', // #129
|
||||
'', // #130
|
||||
'', // #131
|
||||
'', // #132
|
||||
'', // #133
|
||||
'', // #134
|
||||
'', // #135
|
||||
'', // #136
|
||||
'', // #137
|
||||
'', // #138
|
||||
'', // #139
|
||||
'', // #140
|
||||
'', // #141
|
||||
'', // #142
|
||||
'', // #143
|
||||
'', // #144
|
||||
'', // #145
|
||||
'', // #146
|
||||
'', // #147
|
||||
'', // #148
|
||||
'', // #149
|
||||
'', // #150
|
||||
'', // #151
|
||||
'', // #152
|
||||
'', // #153
|
||||
'', // #154
|
||||
'', // #155
|
||||
'', // #156
|
||||
'', // #157
|
||||
'', // #158
|
||||
'', // #159
|
||||
'', // #160
|
||||
'', // #161
|
||||
'', // #162
|
||||
'', // #163
|
||||
'', // #164
|
||||
'', // #165
|
||||
'', // #166
|
||||
'', // #167
|
||||
'', // #168
|
||||
'', // #169
|
||||
'', // #170
|
||||
'', // #171
|
||||
'', // #172
|
||||
'', // #173
|
||||
'', // #174
|
||||
'', // #175
|
||||
'', // #176
|
||||
'', // #177
|
||||
'', // #178
|
||||
'', // #179
|
||||
'', // #180
|
||||
'', // #181
|
||||
'', // #182
|
||||
'', // #183
|
||||
'', // #184
|
||||
'', // #185
|
||||
'', // #186
|
||||
'', // #187
|
||||
'', // #188
|
||||
'', // #189
|
||||
'', // #190
|
||||
'', // #191
|
||||
// RFC 1489 https://tools.ietf.org/html/rfc1489
|
||||
#226#148#128, // #128
|
||||
#226#148#130, // #129
|
||||
#226#148#140, // #130
|
||||
#226#148#144, // #131
|
||||
#226#148#148, // #132
|
||||
#226#148#152, // #133
|
||||
#226#148#156, // #134
|
||||
#226#148#164, // #135
|
||||
#226#148#172, // #136
|
||||
#226#148#180, // #137
|
||||
#226#148#188, // #138
|
||||
#226#150#128, // #139
|
||||
#226#150#132, // #140
|
||||
#226#150#136, // #141
|
||||
#226#150#140, // #142
|
||||
#226#150#144, // #143
|
||||
#226#150#145, // #144
|
||||
#226#150#146, // #145
|
||||
#226#150#147, // #146
|
||||
#226#140#160, // #147
|
||||
#226#150#160, // #148
|
||||
#226#136#153, // #149
|
||||
#226#136#154, // #150
|
||||
#226#137#136, // #151
|
||||
#226#137#164, // #152
|
||||
#226#137#165, // #153
|
||||
#194#160, // #154
|
||||
#226#140#161, // #155
|
||||
#194#176, // #156
|
||||
#194#178, // #157
|
||||
#194#183, // #158
|
||||
#195#183, // #159
|
||||
#226#149#144, // #160
|
||||
#226#149#145, // #161
|
||||
#226#149#146, // #162
|
||||
#209#145, // #163
|
||||
#226#149#147, // #164
|
||||
#226#149#148, // #165
|
||||
#226#149#149, // #166
|
||||
#226#149#150, // #167
|
||||
#226#149#151, // #168
|
||||
#226#149#152, // #169
|
||||
#226#149#153, // #170
|
||||
#226#149#154, // #171
|
||||
#226#149#155, // #172
|
||||
#226#149#156, // #173
|
||||
#226#149#157, // #174
|
||||
#226#149#158, // #175
|
||||
#226#149#159, // #176
|
||||
#226#149#160, // #177
|
||||
#226#149#161, // #178
|
||||
#208#129, // #179
|
||||
#226#149#162, // #180
|
||||
#226#149#163, // #181
|
||||
#226#149#164, // #182
|
||||
#226#149#165, // #183
|
||||
#226#149#166, // #184
|
||||
#226#149#167, // #185
|
||||
#226#149#168, // #186
|
||||
#226#149#169, // #187
|
||||
#226#149#170, // #188
|
||||
#226#149#171, // #189
|
||||
#226#149#172, // #190
|
||||
#194#169, // #191
|
||||
#209#142, // #192
|
||||
#208#176, // #193
|
||||
#208#177, // #194
|
||||
@ -4672,7 +4673,527 @@ const
|
||||
#208#173, // #252
|
||||
#208#169, // #253
|
||||
#208#167, // #254
|
||||
'' // #255
|
||||
#208#170 // #255
|
||||
);
|
||||
|
||||
ArrayKOI8UToUTF8: TCharToUTF8Table = (
|
||||
#0, // #0
|
||||
#1, // #1
|
||||
#2, // #2
|
||||
#3, // #3
|
||||
#4, // #4
|
||||
#5, // #5
|
||||
#6, // #6
|
||||
#7, // #7
|
||||
#8, // #8
|
||||
#9, // #9
|
||||
#10, // #10
|
||||
#11, // #11
|
||||
#12, // #12
|
||||
#13, // #13
|
||||
#14, // #14
|
||||
#15, // #15
|
||||
#16, // #16
|
||||
#17, // #17
|
||||
#18, // #18
|
||||
#19, // #19
|
||||
#20, // #20
|
||||
#21, // #21
|
||||
#22, // #22
|
||||
#23, // #23
|
||||
#24, // #24
|
||||
#25, // #25
|
||||
#26, // #26
|
||||
#27, // #27
|
||||
#28, // #28
|
||||
#29, // #29
|
||||
#30, // #30
|
||||
#31, // #31
|
||||
' ', // ' '
|
||||
'!', // '!'
|
||||
'"', // '"'
|
||||
'#', // '#'
|
||||
'$', // '$'
|
||||
'%', // '%'
|
||||
'&', // '&'
|
||||
'''', // ''''
|
||||
'(', // '('
|
||||
')', // ')'
|
||||
'*', // '*'
|
||||
'+', // '+'
|
||||
',', // ','
|
||||
'-', // '-'
|
||||
'.', // '.'
|
||||
'/', // '/'
|
||||
'0', // '0'
|
||||
'1', // '1'
|
||||
'2', // '2'
|
||||
'3', // '3'
|
||||
'4', // '4'
|
||||
'5', // '5'
|
||||
'6', // '6'
|
||||
'7', // '7'
|
||||
'8', // '8'
|
||||
'9', // '9'
|
||||
':', // ':'
|
||||
';', // ';'
|
||||
'<', // '<'
|
||||
'=', // '='
|
||||
'>', // '>'
|
||||
'?', // '?'
|
||||
'@', // '@'
|
||||
'A', // 'A'
|
||||
'B', // 'B'
|
||||
'C', // 'C'
|
||||
'D', // 'D'
|
||||
'E', // 'E'
|
||||
'F', // 'F'
|
||||
'G', // 'G'
|
||||
'H', // 'H'
|
||||
'I', // 'I'
|
||||
'J', // 'J'
|
||||
'K', // 'K'
|
||||
'L', // 'L'
|
||||
'M', // 'M'
|
||||
'N', // 'N'
|
||||
'O', // 'O'
|
||||
'P', // 'P'
|
||||
'Q', // 'Q'
|
||||
'R', // 'R'
|
||||
'S', // 'S'
|
||||
'T', // 'T'
|
||||
'U', // 'U'
|
||||
'V', // 'V'
|
||||
'W', // 'W'
|
||||
'X', // 'X'
|
||||
'Y', // 'Y'
|
||||
'Z', // 'Z'
|
||||
'[', // '['
|
||||
'\', // '\'
|
||||
']', // ']'
|
||||
'^', // '^'
|
||||
'_', // '_'
|
||||
'`', // '`'
|
||||
'a', // 'a'
|
||||
'b', // 'b'
|
||||
'c', // 'c'
|
||||
'd', // 'd'
|
||||
'e', // 'e'
|
||||
'f', // 'f'
|
||||
'g', // 'g'
|
||||
'h', // 'h'
|
||||
'i', // 'i'
|
||||
'j', // 'j'
|
||||
'k', // 'k'
|
||||
'l', // 'l'
|
||||
'm', // 'm'
|
||||
'n', // 'n'
|
||||
'o', // 'o'
|
||||
'p', // 'p'
|
||||
'q', // 'q'
|
||||
'r', // 'r'
|
||||
's', // 's'
|
||||
't', // 't'
|
||||
'u', // 'u'
|
||||
'v', // 'v'
|
||||
'w', // 'w'
|
||||
'x', // 'x'
|
||||
'y', // 'y'
|
||||
'z', // 'z'
|
||||
'{', // '{'
|
||||
'|', // '|'
|
||||
'}', // '}'
|
||||
'~', // '~'
|
||||
#127, // #127
|
||||
// RFC 2319 https://tools.ietf.org/html/rfc2319
|
||||
#226#148#128, // #128
|
||||
#226#148#130, // #129
|
||||
#226#148#140, // #130
|
||||
#226#148#144, // #131
|
||||
#226#148#148, // #132
|
||||
#226#148#152, // #133
|
||||
#226#148#156, // #134
|
||||
#226#148#164, // #135
|
||||
#226#148#172, // #136
|
||||
#226#148#180, // #137
|
||||
#226#148#188, // #138
|
||||
#226#150#128, // #139
|
||||
#226#150#132, // #140
|
||||
#226#150#136, // #141
|
||||
#226#150#140, // #142
|
||||
#226#150#144, // #143
|
||||
#226#150#145, // #144
|
||||
#226#150#146, // #145
|
||||
#226#150#147, // #146
|
||||
#226#140#160, // #147
|
||||
#226#150#160, // #148
|
||||
#226#136#153, // #149
|
||||
#226#136#154, // #150
|
||||
#226#137#136, // #151
|
||||
#226#137#164, // #152
|
||||
#226#137#165, // #153
|
||||
#194#160, // #154
|
||||
#226#140#161, // #155
|
||||
#194#176, // #156
|
||||
#194#178, // #157
|
||||
#194#183, // #158
|
||||
#195#183, // #159
|
||||
#226#149#144, // #160
|
||||
#226#149#145, // #161
|
||||
#226#149#146, // #162
|
||||
#209#145, // #163
|
||||
#209#148, // #164
|
||||
#226#149#148, // #165
|
||||
#209#150, // #166
|
||||
#209#151, // #167
|
||||
#226#149#151, // #168
|
||||
#226#149#152, // #169
|
||||
#226#149#153, // #170
|
||||
#226#149#154, // #171
|
||||
#226#149#155, // #172
|
||||
#210#145, // #173
|
||||
#226#149#157, // #174
|
||||
#226#149#158, // #175
|
||||
#226#149#159, // #176
|
||||
#226#149#160, // #177
|
||||
#226#149#161, // #178
|
||||
#208#129, // #179
|
||||
#208#132, // #180
|
||||
#226#149#163, // #181
|
||||
#208#134, // #182
|
||||
#208#135, // #183
|
||||
#226#149#166, // #184
|
||||
#226#149#167, // #185
|
||||
#226#149#168, // #186
|
||||
#226#149#169, // #187
|
||||
#226#149#170, // #188
|
||||
#210#144, // #189
|
||||
#226#149#172, // #190
|
||||
#194#169, // #191
|
||||
#209#142, // #192
|
||||
#208#176, // #193
|
||||
#208#177, // #194
|
||||
#209#134, // #195
|
||||
#208#180, // #196
|
||||
#208#181, // #197
|
||||
#209#132, // #198
|
||||
#208#179, // #199
|
||||
#209#133, // #200
|
||||
#208#184, // #201
|
||||
#208#185, // #202
|
||||
#208#186, // #203
|
||||
#208#187, // #204
|
||||
#208#188, // #205
|
||||
#208#189, // #206
|
||||
#208#190, // #207
|
||||
#208#191, // #208
|
||||
#209#143, // #209
|
||||
#209#128, // #210
|
||||
#209#129, // #211
|
||||
#209#130, // #212
|
||||
#209#131, // #213
|
||||
#208#182, // #214
|
||||
#208#178, // #215
|
||||
#209#140, // #216
|
||||
#209#139, // #217
|
||||
#208#183, // #218
|
||||
#209#136, // #219
|
||||
#209#141, // #220
|
||||
#209#137, // #221
|
||||
#209#135, // #222
|
||||
#209#138, // #223
|
||||
#208#174, // #224
|
||||
#208#144, // #225
|
||||
#208#145, // #226
|
||||
#208#166, // #227
|
||||
#208#148, // #228
|
||||
#208#149, // #229
|
||||
#208#164, // #230
|
||||
#208#147, // #231
|
||||
#208#165, // #232
|
||||
#208#152, // #233
|
||||
#208#153, // #234
|
||||
#208#154, // #235
|
||||
#208#155, // #236
|
||||
#208#156, // #237
|
||||
#208#157, // #238
|
||||
#208#158, // #239
|
||||
#208#159, // #240
|
||||
#208#175, // #241
|
||||
#208#160, // #242
|
||||
#208#161, // #243
|
||||
#208#162, // #244
|
||||
#208#163, // #245
|
||||
#208#150, // #246
|
||||
#208#146, // #247
|
||||
#208#172, // #248
|
||||
#208#171, // #249
|
||||
#208#151, // #250
|
||||
#208#168, // #251
|
||||
#208#173, // #252
|
||||
#208#169, // #253
|
||||
#208#167, // #254
|
||||
#208#170 // #255
|
||||
);
|
||||
|
||||
ArrayKOI8RUToUTF8: TCharToUTF8Table = (
|
||||
#0, // #0
|
||||
#1, // #1
|
||||
#2, // #2
|
||||
#3, // #3
|
||||
#4, // #4
|
||||
#5, // #5
|
||||
#6, // #6
|
||||
#7, // #7
|
||||
#8, // #8
|
||||
#9, // #9
|
||||
#10, // #10
|
||||
#11, // #11
|
||||
#12, // #12
|
||||
#13, // #13
|
||||
#14, // #14
|
||||
#15, // #15
|
||||
#16, // #16
|
||||
#17, // #17
|
||||
#18, // #18
|
||||
#19, // #19
|
||||
#20, // #20
|
||||
#21, // #21
|
||||
#22, // #22
|
||||
#23, // #23
|
||||
#24, // #24
|
||||
#25, // #25
|
||||
#26, // #26
|
||||
#27, // #27
|
||||
#28, // #28
|
||||
#29, // #29
|
||||
#30, // #30
|
||||
#31, // #31
|
||||
' ', // ' '
|
||||
'!', // '!'
|
||||
'"', // '"'
|
||||
'#', // '#'
|
||||
'$', // '$'
|
||||
'%', // '%'
|
||||
'&', // '&'
|
||||
'''', // ''''
|
||||
'(', // '('
|
||||
')', // ')'
|
||||
'*', // '*'
|
||||
'+', // '+'
|
||||
',', // ','
|
||||
'-', // '-'
|
||||
'.', // '.'
|
||||
'/', // '/'
|
||||
'0', // '0'
|
||||
'1', // '1'
|
||||
'2', // '2'
|
||||
'3', // '3'
|
||||
'4', // '4'
|
||||
'5', // '5'
|
||||
'6', // '6'
|
||||
'7', // '7'
|
||||
'8', // '8'
|
||||
'9', // '9'
|
||||
':', // ':'
|
||||
';', // ';'
|
||||
'<', // '<'
|
||||
'=', // '='
|
||||
'>', // '>'
|
||||
'?', // '?'
|
||||
'@', // '@'
|
||||
'A', // 'A'
|
||||
'B', // 'B'
|
||||
'C', // 'C'
|
||||
'D', // 'D'
|
||||
'E', // 'E'
|
||||
'F', // 'F'
|
||||
'G', // 'G'
|
||||
'H', // 'H'
|
||||
'I', // 'I'
|
||||
'J', // 'J'
|
||||
'K', // 'K'
|
||||
'L', // 'L'
|
||||
'M', // 'M'
|
||||
'N', // 'N'
|
||||
'O', // 'O'
|
||||
'P', // 'P'
|
||||
'Q', // 'Q'
|
||||
'R', // 'R'
|
||||
'S', // 'S'
|
||||
'T', // 'T'
|
||||
'U', // 'U'
|
||||
'V', // 'V'
|
||||
'W', // 'W'
|
||||
'X', // 'X'
|
||||
'Y', // 'Y'
|
||||
'Z', // 'Z'
|
||||
'[', // '['
|
||||
'\', // '\'
|
||||
']', // ']'
|
||||
'^', // '^'
|
||||
'_', // '_'
|
||||
'`', // '`'
|
||||
'a', // 'a'
|
||||
'b', // 'b'
|
||||
'c', // 'c'
|
||||
'd', // 'd'
|
||||
'e', // 'e'
|
||||
'f', // 'f'
|
||||
'g', // 'g'
|
||||
'h', // 'h'
|
||||
'i', // 'i'
|
||||
'j', // 'j'
|
||||
'k', // 'k'
|
||||
'l', // 'l'
|
||||
'm', // 'm'
|
||||
'n', // 'n'
|
||||
'o', // 'o'
|
||||
'p', // 'p'
|
||||
'q', // 'q'
|
||||
'r', // 'r'
|
||||
's', // 's'
|
||||
't', // 't'
|
||||
'u', // 'u'
|
||||
'v', // 'v'
|
||||
'w', // 'w'
|
||||
'x', // 'x'
|
||||
'y', // 'y'
|
||||
'z', // 'z'
|
||||
'{', // '{'
|
||||
'|', // '|'
|
||||
'}', // '}'
|
||||
'~', // '~'
|
||||
#127, // #127
|
||||
// http://sofia.nmsu.edu/~mleisher/Software/csets/KOI8RU.TXT
|
||||
#226#148#128, // #128
|
||||
#226#148#130, // #129
|
||||
#226#148#140, // #130
|
||||
#226#148#144, // #131
|
||||
#226#148#148, // #132
|
||||
#226#148#152, // #133
|
||||
#226#148#156, // #134
|
||||
#226#148#164, // #135
|
||||
#226#148#172, // #136
|
||||
#226#148#180, // #137
|
||||
#226#148#188, // #138
|
||||
#226#150#128, // #139
|
||||
#226#150#132, // #140
|
||||
#226#150#136, // #141
|
||||
#226#150#140, // #142
|
||||
#226#150#144, // #143
|
||||
#226#150#145, // #144
|
||||
#226#150#146, // #145
|
||||
#226#150#147, // #146
|
||||
#226#128#156, // #147
|
||||
#226#150#160, // #148
|
||||
#226#136#153, // #149
|
||||
#226#128#157, // #150
|
||||
#226#128#148, // #151
|
||||
#226#132#150, // #152
|
||||
#226#132#162, // #153
|
||||
#194#160, // #154
|
||||
#194#187, // #155
|
||||
#194#174, // #156
|
||||
#194#171, // #157
|
||||
#194#183, // #158
|
||||
#194#164, // #159
|
||||
#226#149#144, // #160
|
||||
#226#149#145, // #161
|
||||
#226#149#146, // #162
|
||||
#209#145, // #163
|
||||
#209#148, // #164
|
||||
#226#149#148, // #165
|
||||
#209#150, // #166
|
||||
#209#151, // #167
|
||||
#226#149#151, // #168
|
||||
#226#149#152, // #169
|
||||
#226#149#153, // #170
|
||||
#226#149#154, // #171
|
||||
#226#149#155, // #172
|
||||
#210#145, // #173
|
||||
#209#158, // #174
|
||||
#226#149#158, // #175
|
||||
#226#149#159, // #176
|
||||
#226#149#160, // #177
|
||||
#226#149#161, // #178
|
||||
#208#129, // #179
|
||||
#208#132, // #180
|
||||
#226#149#163, // #181
|
||||
#208#134, // #182
|
||||
#208#135, // #183
|
||||
#226#149#166, // #184
|
||||
#226#149#167, // #185
|
||||
#226#149#168, // #186
|
||||
#226#149#169, // #187
|
||||
#226#149#170, // #188
|
||||
#210#144, // #189
|
||||
#208#142, // #190
|
||||
#194#169, // #191
|
||||
#209#142, // #192
|
||||
#208#176, // #193
|
||||
#208#177, // #194
|
||||
#209#134, // #195
|
||||
#208#180, // #196
|
||||
#208#181, // #197
|
||||
#209#132, // #198
|
||||
#208#179, // #199
|
||||
#209#133, // #200
|
||||
#208#184, // #201
|
||||
#208#185, // #202
|
||||
#208#186, // #203
|
||||
#208#187, // #204
|
||||
#208#188, // #205
|
||||
#208#189, // #206
|
||||
#208#190, // #207
|
||||
#208#191, // #208
|
||||
#209#143, // #209
|
||||
#209#128, // #210
|
||||
#209#129, // #211
|
||||
#209#130, // #212
|
||||
#209#131, // #213
|
||||
#208#182, // #214
|
||||
#208#178, // #215
|
||||
#209#140, // #216
|
||||
#209#139, // #217
|
||||
#208#183, // #218
|
||||
#209#136, // #219
|
||||
#209#141, // #220
|
||||
#209#137, // #221
|
||||
#209#135, // #222
|
||||
#209#138, // #223
|
||||
#208#174, // #224
|
||||
#208#144, // #225
|
||||
#208#145, // #226
|
||||
#208#166, // #227
|
||||
#208#148, // #228
|
||||
#208#149, // #229
|
||||
#208#164, // #230
|
||||
#208#147, // #231
|
||||
#208#165, // #232
|
||||
#208#152, // #233
|
||||
#208#153, // #234
|
||||
#208#154, // #235
|
||||
#208#155, // #236
|
||||
#208#156, // #237
|
||||
#208#157, // #238
|
||||
#208#158, // #239
|
||||
#208#159, // #240
|
||||
#208#175, // #241
|
||||
#208#160, // #242
|
||||
#208#161, // #243
|
||||
#208#162, // #244
|
||||
#208#163, // #245
|
||||
#208#150, // #246
|
||||
#208#146, // #247
|
||||
#208#172, // #248
|
||||
#208#171, // #249
|
||||
#208#151, // #250
|
||||
#208#168, // #251
|
||||
#208#173, // #252
|
||||
#208#169, // #253
|
||||
#208#167, // #254
|
||||
#208#170 // #255
|
||||
);
|
||||
|
||||
ArrayMacintoshToUTF8: TCharToUTF8Table = (
|
||||
|
@ -74,7 +74,9 @@ const
|
||||
EncodingCP950 = 'cp950';
|
||||
|
||||
EncodingCPMac = 'macintosh';
|
||||
EncodingCPKOI8 = 'koi8';
|
||||
EncodingCPKOI8R = 'koi8r';
|
||||
EncodingCPKOI8U = 'koi8u';
|
||||
EncodingCPKOI8RU = 'koi8ru';
|
||||
|
||||
EncodingCPIso1 = 'iso88591';
|
||||
EncodingCPIso2 = 'iso88592';
|
||||
@ -136,7 +138,7 @@ function CP850ToUTF8(const s: string): string; // DOS western europe
|
||||
function CP852ToUTF8(const s: string): string; // DOS central europe
|
||||
function CP866ToUTF8(const s: string): string; // DOS and Windows console's cyrillic
|
||||
function CP874ToUTF8(const s: string): string; // thai
|
||||
function KOI8ToUTF8(const s: string): string; // russian cyrillic
|
||||
function KOI8RToUTF8(const s: string): string; // russian cyrillic
|
||||
function MacintoshToUTF8(const s: string): string; // Macintosh, alias Mac OS Roman
|
||||
function SingleByteToUTF8(const s: string; const Table: TCharToUTF8Table): string;
|
||||
function UCS2LEToUTF8(const s: string): string; // UCS2-LE 2byte little endian
|
||||
@ -161,7 +163,7 @@ function UTF8ToCP850(const s: string; SetTargetCodePage: boolean = false): RawBy
|
||||
function UTF8ToCP852(const s: string; SetTargetCodePage: boolean = false): RawByteString; // DOS central europe
|
||||
function UTF8ToCP866(const s: string; SetTargetCodePage: boolean = false): RawByteString; // DOS and Windows console's cyrillic
|
||||
function UTF8ToCP874(const s: string; SetTargetCodePage: boolean = false): RawByteString; // thai
|
||||
function UTF8ToKOI8(const s: string; SetTargetCodePage: boolean = false): RawByteString; // russian cyrillic
|
||||
function UTF8ToKOI8R(const s: string; SetTargetCodePage: boolean = false): RawByteString; // russian cyrillic
|
||||
function UTF8ToKOI8U(const s: string; SetTargetCodePage: boolean = false): RawByteString; // ukrainian cyrillic
|
||||
function UTF8ToKOI8RU(const s: string; SetTargetCodePage: boolean = false): RawByteString; // belarussian cyrillic
|
||||
function UTF8ToMacintosh(const s: string; SetTargetCodePage: boolean = false): RawByteString; // Macintosh, alias Mac OS Roman
|
||||
@ -183,7 +185,7 @@ function UTF8ToCP850(const s: string): string; // DOS western europe
|
||||
function UTF8ToCP852(const s: string): string; // DOS central europe
|
||||
function UTF8ToCP866(const s: string): string; // DOS and Windows console's cyrillic
|
||||
function UTF8ToCP874(const s: string): string; // thai
|
||||
function UTF8ToKOI8(const s: string): string; // russian cyrillic
|
||||
function UTF8ToKOI8R(const s: string): string; // russian cyrillic
|
||||
function UTF8ToKOI8U(const s: string): string; // ukrainian cyrillic
|
||||
function UTF8ToKOI8RU(const s: string): string; // belarussian cyrillic
|
||||
function UTF8ToMacintosh(const s: string): string; // Macintosh, alias Mac OS Roman
|
||||
@ -413,9 +415,19 @@ begin
|
||||
Result:=SingleByteToUTF8(s,ArrayCP874ToUTF8);
|
||||
end;
|
||||
|
||||
function KOI8ToUTF8(const s: string): string;
|
||||
function KOI8RToUTF8(const s: string): string;
|
||||
begin
|
||||
Result:=SingleByteToUTF8(s,ArrayKOI8ToUTF8);
|
||||
Result:=SingleByteToUTF8(s,ArrayKOI8RToUTF8);
|
||||
end;
|
||||
|
||||
function KOI8UToUTF8(const s: string): string;
|
||||
begin
|
||||
Result:=SingleByteToUTF8(s,ArrayKOI8UToUTF8);
|
||||
end;
|
||||
|
||||
function KOI8RUToUTF8(const s: string): string;
|
||||
begin
|
||||
Result:=SingleByteToUTF8(s,ArrayKOI8RUToUTF8);
|
||||
end;
|
||||
|
||||
function MacintoshToUTF8(const s: string): string;
|
||||
@ -1042,79 +1054,6 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function UnicodeToKOI8(Unicode: cardinal): integer;
|
||||
begin
|
||||
case Unicode of
|
||||
0..127: Result:=Unicode;
|
||||
1040..1041: Result:=Unicode-815;
|
||||
1042: Result:=247;
|
||||
1043: Result:=231;
|
||||
1044..1045: Result:=Unicode-816;
|
||||
1046: Result:=246;
|
||||
1047: Result:=250;
|
||||
1048..1055: Result:=Unicode-815;
|
||||
1056..1059: Result:=Unicode-814;
|
||||
1060: Result:=230;
|
||||
1061: Result:=232;
|
||||
1062: Result:=227;
|
||||
1063: Result:=254;
|
||||
1064: Result:=251;
|
||||
1065: Result:=253;
|
||||
1067: Result:=249;
|
||||
1068: Result:=248;
|
||||
1069: Result:=252;
|
||||
1070: Result:=224;
|
||||
1071: Result:=241;
|
||||
1072..1073: Result:=Unicode-879;
|
||||
1074: Result:=215;
|
||||
1075: Result:=199;
|
||||
1076..1077: Result:=Unicode-880;
|
||||
1078: Result:=214;
|
||||
1079: Result:=218;
|
||||
1080..1087: Result:=Unicode-879;
|
||||
1088..1091: Result:=Unicode-878;
|
||||
1092: Result:=198;
|
||||
1093: Result:=200;
|
||||
1094: Result:=195;
|
||||
1095: Result:=222;
|
||||
1096: Result:=219;
|
||||
1097: Result:=221;
|
||||
1098: Result:=223;
|
||||
1099: Result:=217;
|
||||
1100: Result:=216;
|
||||
1101: Result:=220;
|
||||
1102: Result:=192;
|
||||
1103: Result:=209;
|
||||
else Result:=-1;
|
||||
end;
|
||||
end;
|
||||
|
||||
function UnicodeToKOI8U(Unicode: cardinal): integer;
|
||||
begin
|
||||
case Unicode of
|
||||
1025: Result:=179;
|
||||
1028: Result:=180;
|
||||
1030..1031: Result:=Unicode-848;
|
||||
1105: Result:=163;
|
||||
1108: Result:=164;
|
||||
1110..1111: Result:=Unicode-944;
|
||||
1168: Result:=189;
|
||||
1169: Result:=173;
|
||||
else
|
||||
Result:=UnicodeToKOI8(Unicode);
|
||||
end;
|
||||
end;
|
||||
|
||||
function UnicodeToKOI8RU(Unicode: cardinal): integer;
|
||||
begin
|
||||
case Unicode of
|
||||
1038: Result:=190;
|
||||
1118: Result:=174;
|
||||
else
|
||||
Result:=UnicodeToKOI8U(Unicode);
|
||||
end;
|
||||
end;
|
||||
|
||||
function UnicodeToISO_8859_1(Unicode: cardinal): integer;
|
||||
begin
|
||||
case Unicode of
|
||||
@ -1351,6 +1290,122 @@ begin
|
||||
end;
|
||||
{$endif}
|
||||
|
||||
function UnicodeToKOI8R(Unicode: cardinal): integer;
|
||||
begin
|
||||
case Unicode of
|
||||
0..127: Result:=Unicode;
|
||||
160: Result:=154;
|
||||
169: Result:=191;
|
||||
176: Result:=156;
|
||||
178: Result:=157;
|
||||
183: Result:=158;
|
||||
247: Result:=159;
|
||||
1025: Result:=179;
|
||||
1040..1041: Result:=Unicode-815;
|
||||
1042: Result:=247;
|
||||
1043: Result:=231;
|
||||
1044..1045: Result:=Unicode-816;
|
||||
1046: Result:=246;
|
||||
1047: Result:=250;
|
||||
1048..1055: Result:=Unicode-815;
|
||||
1056..1059: Result:=Unicode-814;
|
||||
1060: Result:=230;
|
||||
1061: Result:=232;
|
||||
1062: Result:=227;
|
||||
1063: Result:=254;
|
||||
1064: Result:=251;
|
||||
1065: Result:=253;
|
||||
1066: Result:=255;
|
||||
1067: Result:=249;
|
||||
1068: Result:=248;
|
||||
1069: Result:=252;
|
||||
1070: Result:=224;
|
||||
1071: Result:=241;
|
||||
1072..1073: Result:=Unicode-879;
|
||||
1074: Result:=215;
|
||||
1075: Result:=199;
|
||||
1076..1077: Result:=Unicode-880;
|
||||
1078: Result:=214;
|
||||
1079: Result:=218;
|
||||
1080..1087: Result:=Unicode-879;
|
||||
1088..1091: Result:=Unicode-878;
|
||||
1092: Result:=198;
|
||||
1093: Result:=200;
|
||||
1094: Result:=195;
|
||||
1095: Result:=222;
|
||||
1096: Result:=219;
|
||||
1097: Result:=221;
|
||||
1098: Result:=223;
|
||||
1099: Result:=217;
|
||||
1100: Result:=216;
|
||||
1101: Result:=220;
|
||||
1102: Result:=192;
|
||||
1103: Result:=209;
|
||||
1105: Result:=163;
|
||||
8729: Result:=149;
|
||||
8730: Result:=150;
|
||||
8776: Result:=151;
|
||||
8804: Result:=152;
|
||||
8805: Result:=153;
|
||||
8992: Result:=147;
|
||||
8993: Result:=155;
|
||||
9472: Result:=128;
|
||||
9474: Result:=129;
|
||||
9484: Result:=130;
|
||||
9488: Result:=131;
|
||||
9492: Result:=132;
|
||||
9496: Result:=133;
|
||||
9500: Result:=134;
|
||||
9508: Result:=135;
|
||||
9516: Result:=136;
|
||||
9524: Result:=137;
|
||||
9532: Result:=138;
|
||||
9552..9554: Result:=Unicode-9392;
|
||||
9555..9569: Result:=Unicode-9391;
|
||||
9570..9580: Result:=Unicode-9390;
|
||||
9600: Result:=139;
|
||||
9604: Result:=140;
|
||||
9608: Result:=141;
|
||||
9612: Result:=142;
|
||||
9616..9619: Result:=Unicode-9473;
|
||||
9632: Result:=148;
|
||||
else Result:=-1;
|
||||
end;
|
||||
end;
|
||||
|
||||
function UnicodeToKOI8U(Unicode: cardinal): integer;
|
||||
begin
|
||||
case Unicode of
|
||||
1028: Result:=180;
|
||||
1030..1031: Result:=Unicode-848;
|
||||
1108: Result:=164;
|
||||
1110..1111: Result:=Unicode-944;
|
||||
1168: Result:=189;
|
||||
1169: Result:=173;
|
||||
else
|
||||
Result:=UnicodeToKOI8R(Unicode);
|
||||
end;
|
||||
end;
|
||||
|
||||
function UnicodeToKOI8RU(Unicode: cardinal): integer;
|
||||
begin
|
||||
case Unicode of
|
||||
164 : Result:=159;
|
||||
171 : Result:=157;
|
||||
174 : Result:=156;
|
||||
187 : Result:=155;
|
||||
1038: Result:=190;
|
||||
1118: Result:=174;
|
||||
8212: Result:=151;
|
||||
8220: Result:=147;
|
||||
8221: Result:=150;
|
||||
8470: Result:=152;
|
||||
8482: Result:=153;
|
||||
else
|
||||
Result:=UnicodeToKOI8U(Unicode);
|
||||
end;
|
||||
end;
|
||||
|
||||
function UnicodeToCP1250(Unicode: cardinal): integer;
|
||||
begin
|
||||
case Unicode of
|
||||
@ -1959,9 +2014,9 @@ begin
|
||||
InternalUTF8ToCP(s,874,SetTargetCodePage,@UnicodeToCP874,Result);
|
||||
end;
|
||||
|
||||
function UTF8ToKOI8(const s: string; SetTargetCodePage: boolean): RawByteString;
|
||||
function UTF8ToKOI8R(const s: string; SetTargetCodePage: boolean): RawByteString;
|
||||
begin
|
||||
InternalUTF8ToCP(s,20866,SetTargetCodePage,{$IfDef UseSystemCPConv}nil{$else}@UnicodeToKOI8{$endif},Result);
|
||||
InternalUTF8ToCP(s,20866,SetTargetCodePage,{$IfDef UseSystemCPConv}nil{$else}@UnicodeToKOI8R{$endif},Result);
|
||||
end;
|
||||
|
||||
function UTF8ToKOI8U(const s: string; SetTargetCodePage: boolean): RawByteString;
|
||||
@ -1971,7 +2026,8 @@ end;
|
||||
|
||||
function UTF8ToKOI8RU(const s: string; SetTargetCodePage: boolean): RawByteString;
|
||||
begin
|
||||
InternalUTF8ToCP(s,21866,SetTargetCodePage,{$IfDef UseSystemCPConv}nil{$else}@UnicodeToKOI8RU{$endif},Result);
|
||||
// KOI8-RU dont have code page
|
||||
InternalUTF8ToCP(s,0,SetTargetCodePage,@UnicodeToKOI8RU,Result);
|
||||
end;
|
||||
|
||||
function UTF8ToMacintosh(const s: string; SetTargetCodePage: boolean): RawByteString;
|
||||
@ -2064,9 +2120,9 @@ begin
|
||||
Result:=UTF8ToSingleByte(s,@UnicodeToCP874);
|
||||
end;
|
||||
|
||||
function UTF8ToKOI8(const s: string): string;
|
||||
function UTF8ToKOI8R(const s: string): string;
|
||||
begin
|
||||
Result:=UTF8ToSingleByte(s,@UnicodeToKOI8);
|
||||
Result:=UTF8ToSingleByte(s,@UnicodeToKOI8R);
|
||||
end;
|
||||
|
||||
function UTF8ToKOI8U(const s: string): string;
|
||||
@ -2239,7 +2295,9 @@ begin
|
||||
List.Add('ISO-8859-2');
|
||||
List.Add('ISO-8859-15');
|
||||
|
||||
List.Add('KOI-8');
|
||||
List.Add('KOI8-R');
|
||||
List.Add('KOI8-U');
|
||||
List.Add('KOI8-RU');
|
||||
List.Add('Macintosh');
|
||||
|
||||
// UCS2 are less common, list them last
|
||||
@ -2412,7 +2470,9 @@ begin
|
||||
if ATo=EncodingCP949 then begin Result:=UTF8ToCP949(s{$ifdef FPC_HAS_CPSTRING},SetTargetCodePage{$endif}); exit; end;
|
||||
if ATo=EncodingCP932 then begin Result:=UTF8ToCP932(s{$ifdef FPC_HAS_CPSTRING},SetTargetCodePage{$endif}); exit; end;
|
||||
{$ENDIF}
|
||||
if ATo=EncodingCPKOI8 then begin Result:=UTF8ToKOI8(s{$ifdef FPC_HAS_CPSTRING},SetTargetCodePage{$endif}); exit; end;
|
||||
if ATo=EncodingCPKOI8R then begin Result:=UTF8ToKOI8R(s{$ifdef FPC_HAS_CPSTRING},SetTargetCodePage{$endif}); exit; end;
|
||||
if ATo=EncodingCPKOI8U then begin Result:=UTF8ToKOI8U(s{$ifdef FPC_HAS_CPSTRING},SetTargetCodePage{$endif}); exit; end;
|
||||
if ATo=EncodingCPKOI8RU then begin Result:=UTF8ToKOI8RU(s{$ifdef FPC_HAS_CPSTRING},SetTargetCodePage{$endif}); exit; end;
|
||||
if ATo=EncodingCPMac then begin Result:=UTF8ToMacintosh(s{$ifdef FPC_HAS_CPSTRING},SetTargetCodePage{$endif}); exit; end;
|
||||
if ATo=EncodingUCS2LE then begin {$ifdef FPC_HAS_CPSTRING}CheckKeepCP;{$endif} Result:=UTF8ToUCS2LE(s); exit; end;
|
||||
if ATo=EncodingUCS2BE then begin {$ifdef FPC_HAS_CPSTRING}CheckKeepCP;{$endif} Result:=UTF8ToUCS2BE(s); exit; end;
|
||||
@ -2457,7 +2517,9 @@ begin
|
||||
if AFrom=EncodingCP949 then begin Result:=CP949ToUTF8(s); exit; end;
|
||||
if AFrom=EncodingCP932 then begin Result:=CP932ToUTF8(s); exit; end;
|
||||
{$ENDIF}
|
||||
if AFrom=EncodingCPKOI8 then begin Result:=KOI8ToUTF8(s); exit; end;
|
||||
if AFrom=EncodingCPKOI8R then begin Result:=KOI8RToUTF8(s); exit; end;
|
||||
if AFrom=EncodingCPKOI8U then begin Result:=KOI8UToUTF8(s); exit; end;
|
||||
if AFrom=EncodingCPKOI8RU then begin Result:=KOI8RUToUTF8(s); exit; end;
|
||||
if AFrom=EncodingCPMac then begin Result:=MacintoshToUTF8(s); exit; end;
|
||||
if AFrom=EncodingUCS2LE then begin Result:=UCS2LEToUTF8(s); exit; end;
|
||||
if AFrom=EncodingUCS2BE then begin Result:=UCS2BEToUTF8(s); exit; end;
|
||||
|
Loading…
Reference in New Issue
Block a user