mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-06 18:24:26 +08:00
Add helper "SaveUnicodeFile"
This commit is contained in:
@ -92,6 +92,7 @@ type
|
|||||||
function GetTempDir: String;
|
function GetTempDir: String;
|
||||||
function GetDBObjectType( TableStatus: TFields ): Byte;
|
function GetDBObjectType( TableStatus: TFields ): Byte;
|
||||||
procedure SetWindowSizeGrip(hWnd: HWND; Enable: boolean);
|
procedure SetWindowSizeGrip(hWnd: HWND; Enable: boolean);
|
||||||
|
procedure SaveUnicodeFile(Filename: String; Text: WideString);
|
||||||
|
|
||||||
var
|
var
|
||||||
MYSQL_KEYWORDS : TStringList;
|
MYSQL_KEYWORDS : TStringList;
|
||||||
@ -2352,6 +2353,26 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{**
|
||||||
|
Save a textfile with unicode
|
||||||
|
}
|
||||||
|
procedure SaveUnicodeFile(Filename: String; Text: WideString);
|
||||||
|
var
|
||||||
|
f: TFileStream;
|
||||||
|
header: array[0..1] of Byte;
|
||||||
|
begin
|
||||||
|
header[0] := $FF;
|
||||||
|
header[1] := $FE;
|
||||||
|
f := TFileStream.Create(Filename, fmCreate or fmOpenWrite);
|
||||||
|
try
|
||||||
|
f.WriteBuffer(header, 2);
|
||||||
|
f.WriteBuffer(Pointer(Text)^, Length(Text) * 2);
|
||||||
|
finally
|
||||||
|
f.Free;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user