mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-16 16:12:57 +02:00
LCL: renamed CPConvert to ConvertEncoding
git-svn-id: trunk@13543 -
This commit is contained in:
parent
92c1cfafa2
commit
dc816283ee
@ -11047,6 +11047,8 @@ procedure TMainIDE.OnCodeBufferDecodeLoaded(Code: TCodeBuffer;
|
|||||||
const Filename: string; var Source, DiskEncoding, MemEncoding: string);
|
const Filename: string; var Source, DiskEncoding, MemEncoding: string);
|
||||||
begin
|
begin
|
||||||
//DebugLn(['TMainIDE.OnCodeBufferDecodeLoaded Filename=',Filename,' Encoding=',GuessEncoding(Source)]);
|
//DebugLn(['TMainIDE.OnCodeBufferDecodeLoaded Filename=',Filename,' Encoding=',GuessEncoding(Source)]);
|
||||||
|
//DiskEncoding:=GuessEncoding(Source);
|
||||||
|
//MemEncoding:=EncodingUTF8;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainIDE.OnCodeBufferEncodeSaving(Code: TCodeBuffer;
|
procedure TMainIDE.OnCodeBufferEncodeSaving(Code: TCodeBuffer;
|
||||||
|
@ -34,9 +34,9 @@ const
|
|||||||
|
|
||||||
function GuessEncoding(const s: string): string;
|
function GuessEncoding(const s: string): string;
|
||||||
|
|
||||||
function CPConvert(const s,from,toC:string):string;
|
function ConvertEncoding(const s, FromEncoding, ToEncoding: string): string;
|
||||||
|
|
||||||
function GetSystemEncoding:string;
|
function GetSystemEncoding: string;
|
||||||
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
@ -354,14 +354,14 @@ begin
|
|||||||
Result:=GetSystemEncoding;
|
Result:=GetSystemEncoding;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function CPConvert(const s,from,toC:string):string;
|
function ConvertEncoding(const s, FromEncoding, ToEncoding: string): string;
|
||||||
var AFrom,ATo:string;
|
var AFrom,ATo:string;
|
||||||
SL:TStringList;
|
SL:TStringList;
|
||||||
FN1,FN2:string;
|
FN1,FN2:string;
|
||||||
begin
|
begin
|
||||||
Result:=s;
|
Result:=s;
|
||||||
AFrom:=LowerCase(from);
|
AFrom:=LowerCase(FromEncoding);
|
||||||
ATo:=LowerCase(toC);
|
ATo:=LowerCase(ToEncoding);
|
||||||
if AFrom=ATo then exit;
|
if AFrom=ATo then exit;
|
||||||
if ATo='koi8r' then ATo:='koi8-r';
|
if ATo='koi8r' then ATo:='koi8-r';
|
||||||
if AFrom='koi8r' then AFrom:='koi8-r';
|
if AFrom='koi8r' then AFrom:='koi8-r';
|
||||||
@ -383,7 +383,7 @@ begin
|
|||||||
FN1:=GetTempFileName;
|
FN1:=GetTempFileName;
|
||||||
SL.SaveToFile(FN1);
|
SL.SaveToFile(FN1);
|
||||||
FN2:=GetTempFileName;
|
FN2:=GetTempFileName;
|
||||||
fpSystem('iconv -f '+from+' -t '+toC+#60+FN1+' >'+FN2);
|
fpSystem('iconv -f '+FromEncoding+' -t '+ToEncoding+#60+FN1+' >'+FN2);
|
||||||
SL.LoadFromFile(FN2);
|
SL.LoadFromFile(FN2);
|
||||||
if SL.Text<>'' then
|
if SL.Text<>'' then
|
||||||
Result:=SL.Text
|
Result:=SL.Text
|
||||||
|
Loading…
Reference in New Issue
Block a user