mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-23 04:19:47 +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);
|
||||
begin
|
||||
//DebugLn(['TMainIDE.OnCodeBufferDecodeLoaded Filename=',Filename,' Encoding=',GuessEncoding(Source)]);
|
||||
//DiskEncoding:=GuessEncoding(Source);
|
||||
//MemEncoding:=EncodingUTF8;
|
||||
end;
|
||||
|
||||
procedure TMainIDE.OnCodeBufferEncodeSaving(Code: TCodeBuffer;
|
||||
|
@ -34,9 +34,9 @@ const
|
||||
|
||||
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
|
||||
@ -354,14 +354,14 @@ begin
|
||||
Result:=GetSystemEncoding;
|
||||
end;
|
||||
|
||||
function CPConvert(const s,from,toC:string):string;
|
||||
function ConvertEncoding(const s, FromEncoding, ToEncoding: string): string;
|
||||
var AFrom,ATo:string;
|
||||
SL:TStringList;
|
||||
FN1,FN2:string;
|
||||
begin
|
||||
Result:=s;
|
||||
AFrom:=LowerCase(from);
|
||||
ATo:=LowerCase(toC);
|
||||
AFrom:=LowerCase(FromEncoding);
|
||||
ATo:=LowerCase(ToEncoding);
|
||||
if AFrom=ATo then exit;
|
||||
if ATo='koi8r' then ATo:='koi8-r';
|
||||
if AFrom='koi8r' then AFrom:='koi8-r';
|
||||
@ -383,7 +383,7 @@ begin
|
||||
FN1:=GetTempFileName;
|
||||
SL.SaveToFile(FN1);
|
||||
FN2:=GetTempFileName;
|
||||
fpSystem('iconv -f '+from+' -t '+toC+#60+FN1+' >'+FN2);
|
||||
fpSystem('iconv -f '+FromEncoding+' -t '+ToEncoding+#60+FN1+' >'+FN2);
|
||||
SL.LoadFromFile(FN2);
|
||||
if SL.Text<>'' then
|
||||
Result:=SL.Text
|
||||
|
Loading…
Reference in New Issue
Block a user