Thanks Paweld.
If I strip away all the extra stuff in LconvEncoding, I get what i want.......simple code that shows how my simple needs are implemented:
P.S. I still don't know who to insert code properly ???
unit
Cp437;
{$H+}
interface
function CP437ToUTF8(const s: string): string;
implementation
type
TCharToUTF8Table = array[Char] Of PChar;
const
ArrayCP437ToUTF8 : 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
#195#135, // #128
#195#188, // #129
#195#169, // #130
#195#162, // #131
#195#164, // #132
#195#160, // #133
#195#165, // #134
#195#167, // #135
#195#170, // #136
#195#171, // #137
#195#168, // #138
#195#175, // #139
#195#174, // #140
#195#172, // #141
#195#132, // #142
#195#133, // #143
#195#137, // #144
#195#166, // #145
#195#134, // #146
#195#180, // #147
#195#182, // #148
#195#178, // #149
#195#187, // #150
#195#185, // #151
#195#191, // #152
#195#150, // #153
#195#156, // #154
#194#162, // #155
#194#163, // #156
#194#165, // #157
#226#130#167, // #158
#198#146, // #159
#195#161, // #160
#195#173, // #161
#195#179, // #162
#195#186, // #163
#195#177, // #164
#195#145, // #165
#194#170, // #166
#194#186, // #167
#194#191, // #168
#226#140#144, // #169
#194#172, // #170
#194#189, // #171
#194#188, // #172
#194#161, // #173
#194#171, // #174
#194#187, // #175
#226#150#145, // #176
#226#150#146, // #177
#226#150#147, // #178
#226#148#130, // #179
#226#148#164, // #180
#226#149#161, // #181
#226#149#162, // #182
#226#149#150, // #183
#226#149#149, // #184
#226#149#163, // #185
#226#149#145, // #186
#226#149#151, // #187
#226#149#157, // #188
#226#149#156, // #189
#226#149#155, // #190
#226#148#144, // #191
#226#148#148, // #192
#226#148#180, // #193
#226#148#172, // #194
#226#148#156, // #195
#226#148#128, // #196
#226#148#188, // #197
#226#149#158, // #198
#226#149#159, // #199
#226#149#154, // #200
#226#149#148, // #201
#226#149#169, // #202
#226#149#166, // #203
#226#149#160, // #204
#226#149#144, // #205
#226#149#172, // #206
#226#149#167, // #207
#226#149#168, // #208
#226#149#164, // #209
#226#149#165, // #210
#226#149#153, // #211
#226#149#152, // #212
#226#149#146, // #213
#226#149#147, // #214
#226#149#171, // #215
#226#149#170, // #216
#226#148#152, // #217
#226#148#140, // #218
#226#150#136, // #219
#226#150#132, // #220
#226#150#140, // #221
#226#150#144, // #222
#226#150#128, // #223
#206#177, // #224
#195#159, // #225
#206#147, // #226
#207#128, // #227
#206#163, // #228
#207#131, // #229
#194#181, // #230
#207#132, // #231
#206#166, // #232
#206#152, // #233
#206#169, // #234
#206#180, // #235
#226#136#158, // #236
#207#134, // #237
#206#181, // #238
#226#136#169, // #239
#226#137#161, // #240
#194#177, // #241
#226#137#165, // #242
#226#137#164, // #243
#226#140#160, // #244
#226#140#161, // #245
#195#183, // #246
#226#137#136, // #247
#194#176, // #248
#226#136#153, // #249
#194#183, // #250
#226#136#154, // #251
#226#129#191, // #252
#194#178, // #253
#226#150#160, // #254
#194#160 // #255
);
function SingleByteToUTF8(const s : string; const Table : TCharToUTF8Table) : string;
var
len,
i : Integer;
Src : PChar;
Dest : PChar;
p : PChar;
c : Char;
begin
if s= '' then begin
Result:='';
exit;
end;
len := length(s);
SetLength(Result, len*4);// UTF-8 is at most 4 bytes
Src := PChar(s);
Dest := PChar(Result);
for i := 1 to len do
begin
c := Src^;
inc(Src);
if ord(c) < 128 then
begin
Dest^ := c;
inc(Dest);
end
else
begin
p := Table[c];
if p <> nil then
while p^ <> #0 do
begin
Dest^ := p^;
inc(p);
inc(Dest);
end;
end;
end;
SetLength(Result, {%H-}PtrUInt(Dest)-PtrUInt(Result));
end;
function CP437ToUTF8(const s: string): string;
begin
Result := SingleByteToUTF8(s, ArrayCP437ToUTF8);
end;
begin
end.