mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-07 15:41:50 +02:00
aarre: auto fix non UTF-8
git-svn-id: trunk@41695 -
This commit is contained in:
parent
1dcfc14560
commit
53729efba4
@ -34,7 +34,8 @@ unit AarrePkgList;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, Laz2_XMLCfg, laz2_DOM, LazLogger, FileProcs;
|
Classes, SysUtils, Laz2_XMLCfg, laz2_DOM, LazLogger, LazUTF8, LConvEncoding,
|
||||||
|
FileProcs;
|
||||||
|
|
||||||
type
|
type
|
||||||
TAPackageType = (
|
TAPackageType = (
|
||||||
@ -187,6 +188,7 @@ const
|
|||||||
'RunTime', 'DesignTime', 'RunAndDesignTime', 'RunTimeOnly');
|
'RunTime', 'DesignTime', 'RunAndDesignTime', 'RunTimeOnly');
|
||||||
|
|
||||||
function APackageTypeIdentToType(const s: string): TAPackageType;
|
function APackageTypeIdentToType(const s: string): TAPackageType;
|
||||||
|
function FixUTF8(const s: string): string;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
@ -197,6 +199,17 @@ begin
|
|||||||
Result:=aptRunTime;
|
Result:=aptRunTime;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function FixUTF8(const s: string): string;
|
||||||
|
var
|
||||||
|
i: PtrInt;
|
||||||
|
begin
|
||||||
|
Result:=s;
|
||||||
|
if Result='' then exit;
|
||||||
|
i:=FindInvalidUTF8Character(PChar(Result),length(Result),true);
|
||||||
|
if i<0 then exit;
|
||||||
|
Result:=ISO_8859_1ToUTF8(Result);
|
||||||
|
end;
|
||||||
|
|
||||||
{ TAPkgDependencies }
|
{ TAPkgDependencies }
|
||||||
|
|
||||||
function TAPkgDependencies.GetItems(Index: integer): TAPkgDependency;
|
function TAPkgDependencies.GetItems(Index: integer): TAPkgDependency;
|
||||||
@ -384,9 +397,9 @@ begin
|
|||||||
raise Exception.Create('invalid name ');
|
raise Exception.Create('invalid name ');
|
||||||
PackageType:=APackageTypeIdentToType(xml.GetValue(Path+'Type/Value',
|
PackageType:=APackageTypeIdentToType(xml.GetValue(Path+'Type/Value',
|
||||||
APackageTypeIdents[DefaultPackageType]));
|
APackageTypeIdents[DefaultPackageType]));
|
||||||
Author:=xml.GetValue(Path+'Author/Value','');
|
Author:=FixUTF8(xml.GetValue(Path+'Author/Value',''));
|
||||||
Description:=xml.GetValue(Path+'Description/Value','');
|
Description:=FixUTF8(xml.GetValue(Path+'Description/Value',''));
|
||||||
License:=xml.GetValue(Path+'License/Value','');
|
License:=FixUTF8(xml.GetValue(Path+'License/Value',''));
|
||||||
Version.Load(xml,Path+'Version/');
|
Version.Load(xml,Path+'Version/');
|
||||||
|
|
||||||
NewCount:=xml.GetValue(Path+'RequiredPkgs/Count',0);
|
NewCount:=xml.GetValue(Path+'RequiredPkgs/Count',0);
|
||||||
|
Loading…
Reference in New Issue
Block a user