mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-07 16:16:00 +02:00
iconvtable_dbcs: unicode file names
git-svn-id: trunk@46804 -
This commit is contained in:
parent
14c1684449
commit
9d0156abcc
@ -26,7 +26,7 @@ uses
|
|||||||
cthreads,
|
cthreads,
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
Classes, SysUtils, Unix, LazUTF8, FileUtil, LazLogger, LazFileUtils, MTProcs,
|
Classes, SysUtils, Unix, LazUTF8, FileUtil, LazLogger, LazFileUtils, MTProcs,
|
||||||
LConvEncoding;
|
LConvEncoding, LazUTF8Classes;
|
||||||
|
|
||||||
var
|
var
|
||||||
FromEncoding: String;
|
FromEncoding: String;
|
||||||
@ -109,8 +109,8 @@ procedure AskIconvInParallel(Index: PtrInt; {%H-}Data: Pointer;
|
|||||||
{%H-}Item: TMultiThreadProcItem);
|
{%H-}Item: TMultiThreadProcItem);
|
||||||
var
|
var
|
||||||
FilenameOrig: String;
|
FilenameOrig: String;
|
||||||
FilenameUTF: String;
|
FilenameUTF8: String;
|
||||||
SL: TStringList;
|
SL: TStringListUTF8;
|
||||||
s: String;
|
s: String;
|
||||||
CharLen: integer;
|
CharLen: integer;
|
||||||
i: Integer;
|
i: Integer;
|
||||||
@ -127,15 +127,15 @@ begin
|
|||||||
end;
|
end;
|
||||||
i:=GetThreadIndex;
|
i:=GetThreadIndex;
|
||||||
FilenameOrig:='testorig'+IntToStr(i)+'.txt';
|
FilenameOrig:='testorig'+IntToStr(i)+'.txt';
|
||||||
FilenameUTF:='testutf'+IntToStr(i)+'.txt';
|
FilenameUTF8:='testutf'+IntToStr(i)+'.txt';
|
||||||
DeleteFileUTF8(FilenameOrig);
|
DeleteFileUTF8(FilenameOrig);
|
||||||
DeleteFileUTF8(FilenameUTF);
|
DeleteFileUTF8(FilenameUTF8);
|
||||||
SL:=TStringList.Create;
|
SL:=TStringListUTF8.Create;
|
||||||
SL.Add(chr(Index shr 8)+chr(Index and 255));
|
SL.Add(chr(Index shr 8)+chr(Index and 255));
|
||||||
SL.SaveToFile(UTF8ToSys(FilenameOrig));
|
SL.SaveToFile(FilenameOrig);
|
||||||
if fpSystem('iconv -f '+FromEncoding+' -t '+ToEncoding+' '+FilenameOrig+' >'+FilenameUTF)=0
|
if fpSystem('iconv -f '+FromEncoding+' -t '+ToEncoding+' '+FilenameOrig+' >'+FilenameUTF8)=0
|
||||||
then begin
|
then begin
|
||||||
SL.LoadFromFile(UTF8ToSys(FilenameUTF));
|
SL.LoadFromFile(FilenameUTF8);
|
||||||
s:=SL[0];
|
s:=SL[0];
|
||||||
if s<>'' then begin
|
if s<>'' then begin
|
||||||
DBCSToUTF8[Index]:=UTF8CharacterToUnicode(PChar(s),CharLen);
|
DBCSToUTF8[Index]:=UTF8CharacterToUnicode(PChar(s),CharLen);
|
||||||
|
Loading…
Reference in New Issue
Block a user