From be047c501561268aaffc173e8aec46fa5c3debfb Mon Sep 17 00:00:00 2001 From: mattias Date: Mon, 21 Apr 2008 15:24:20 +0000 Subject: [PATCH] LCL: catching exception for conversion try git-svn-id: trunk@14920 - --- lcl/lconvencoding.pas | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/lcl/lconvencoding.pas b/lcl/lconvencoding.pas index 1ba20b64eb..270b53d76c 100644 --- a/lcl/lconvencoding.pas +++ b/lcl/lconvencoding.pas @@ -4196,23 +4196,23 @@ begin end; //Stupid code. Works anyway, but extra-slow + Result:=s; {$ifdef Unix} DebugLn(['CPConvert NOTE: using slow iconv workaround to convert from ',AFrom,' to ',ATo]); - SL:=TStringList.Create; - SL.Text:=s; - FN1:=GetTempFileName; - SL.SaveToFile(FN1); - FN2:=GetTempFileName; - fpSystem('iconv -f '+FromEncoding+' -t '+ToEncoding+' '+FN1+' >'+FN2); - SL.LoadFromFile(FN2); - if SL.Text<>'' then - Result:=SL.Text - else - Result:=s; - DeleteFile(FN1); - DeleteFile(FN2); - {$else} - Result:=s; + try + SL:=TStringList.Create; + SL.Text:=s; + FN1:=GetTempFileName; + SL.SaveToFile(FN1); + FN2:=GetTempFileName; + fpSystem('iconv -f '+FromEncoding+' -t '+ToEncoding+' '+FN1+' >'+FN2); + SL.LoadFromFile(FN2); + if SL.Text<>'' then + Result:=SL.Text; + DeleteFile(FN1); + DeleteFile(FN2); + except + end; {$endif} end;