mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-07 06:38:06 +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
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Laz2_XMLCfg, laz2_DOM, LazLogger, FileProcs;
|
||||
Classes, SysUtils, Laz2_XMLCfg, laz2_DOM, LazLogger, LazUTF8, LConvEncoding,
|
||||
FileProcs;
|
||||
|
||||
type
|
||||
TAPackageType = (
|
||||
@ -187,6 +188,7 @@ const
|
||||
'RunTime', 'DesignTime', 'RunAndDesignTime', 'RunTimeOnly');
|
||||
|
||||
function APackageTypeIdentToType(const s: string): TAPackageType;
|
||||
function FixUTF8(const s: string): string;
|
||||
|
||||
implementation
|
||||
|
||||
@ -197,6 +199,17 @@ begin
|
||||
Result:=aptRunTime;
|
||||
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 }
|
||||
|
||||
function TAPkgDependencies.GetItems(Index: integer): TAPkgDependency;
|
||||
@ -384,9 +397,9 @@ begin
|
||||
raise Exception.Create('invalid name ');
|
||||
PackageType:=APackageTypeIdentToType(xml.GetValue(Path+'Type/Value',
|
||||
APackageTypeIdents[DefaultPackageType]));
|
||||
Author:=xml.GetValue(Path+'Author/Value','');
|
||||
Description:=xml.GetValue(Path+'Description/Value','');
|
||||
License:=xml.GetValue(Path+'License/Value','');
|
||||
Author:=FixUTF8(xml.GetValue(Path+'Author/Value',''));
|
||||
Description:=FixUTF8(xml.GetValue(Path+'Description/Value',''));
|
||||
License:=FixUTF8(xml.GetValue(Path+'License/Value',''));
|
||||
Version.Load(xml,Path+'Version/');
|
||||
|
||||
NewCount:=xml.GetValue(Path+'RequiredPkgs/Count',0);
|
||||
|
Loading…
Reference in New Issue
Block a user