PowerPDF, convert UTF-8 to ANSI, currently it doesn't support more..

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@717 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
jesusr
2009-02-24 04:03:19 +00:00
parent e7a71a5ffc
commit a122886099
2 changed files with 9 additions and 4 deletions

View File

@ -1055,14 +1055,19 @@ const
var var
i, j: integer; i, j: integer;
flg: boolean; flg: boolean;
S: string;
begin begin
// If text contains chars to need escape, replace text using "\". // If text contains chars to need escape, replace text using "\".
//
// TODO: implement UNICODE support in powerpdf. Currently we can't do
// any better than converting utf-8 strings to unicode.
S := UTF8ToAnsi(Value);
result := ''; result := '';
for i := 1 to Length(Value) do for i := 1 to Length(S) do
begin begin
flg := false; flg := false;
for j := 1 to Length(EscapeChars) do for j := 1 to Length(EscapeChars) do
if Value[i] = EscapeChars[j] then if S[i] = EscapeChars[j] then
begin begin
result := result + '\' + ReplaceChars[j]; result := result + '\' + ReplaceChars[j];
flg := true; flg := true;
@ -1070,7 +1075,7 @@ begin
end; end;
if not flg then if not flg then
result := result + Value[i]; result := result + S[i];
end; end;
end; end;

View File

@ -24,7 +24,7 @@
<CompilerPath Value="$(CompPath)"/> <CompilerPath Value="$(CompPath)"/>
</Other> </Other>
</CompilerOptions> </CompilerOptions>
<Version Minor="9"/> <Version Minor="9" Release="1"/>
<Files Count="12"> <Files Count="12">
<Item1> <Item1>
<Filename Value="PdfTypes.pas"/> <Filename Value="PdfTypes.pas"/>