
02.09.2010, 21:05
|
Прохожий
|
|
Регистрация: 02.09.2010
Сообщения: 1
Репутация: 10
|
|
Попробуй сделать перекодировку после того, как считаешь файл в memo
Код:
for I := 0 to Memo1.Lines.Count - 1 do memo1.Lines[i]:= dostowin(Memo1.Lines[i]) ;
Есть такие функции
Код:
Function dostowin(znak:string):string;
var
sd:LongInt;
m:integer;
sims:string[1];
sim: AnsiChar;
begin
result:='';
for m:=1 to length(znak) do begin
sims:=copy(znak,m,1);
(*{$H-}*)
sim:= ansichar(sims[1]);
sd:=ord(sim);
if (ord(sim)>=128) and (ord(sim)<=159) then
sd:=ord(sim)+64;
if (ord(sim)>=160) and (ord(sim)<=175) then
sd:=ord(sim)+64;
if (ord(sim)>=224) and (ord(sim)<=239) then
sd:=ord(sim)+16;
sim:= (AnsiChar(sd));
sims[1]:=sim;
znak:=copy(znak,1,m-1)+sims[1]+copy(znak,m+1,length(znak));
(*{$H+}*)
result:=znak;
end;
end;
Function wintodos(znak:string):string;
var
sd:LongInt;
m:integer;
sims:string[1];
sim:AnsiChar;
begin
for m:=1 to length(znak) do begin
sims:=copy(znak,m,1);
(*{$H-}*)
sim:=sims[1];
sd:=ord(sim);
if (ord(sim))=13 then
else
begin
if (ord(sim)>=192) and (ord(sim)<=223) then
sd:=ord(sim)-64;
if (ord(sim)>=224) and (ord(sim)<=239) then
sd:=ord(sim)-64;
if (ord(sim)>=240) and (ord(sim)<=255) then
sd:=ord(sim)-16;
sim:= AnsiChar(sd);
end;
sims[1]:=sim;
znak:=copy(znak,1,m-1)+sims[1]+copy(znak,m+1,length(znak));
(*{$H+}*)
result:=znak;
end;
end;
|