mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-06 18:24:26 +08:00
Do not add UTF-8 BOM headers to written files, they are not needed in most cases, and break other tools from reading them, e.g. mysqldump. See http://www.heidisql.com/forum.php?t=4622
This commit is contained in:
@ -165,7 +165,6 @@ type
|
||||
function Max(A, B: Integer): Integer; assembler;
|
||||
function Min(A, B: Integer): Integer; assembler;
|
||||
function urlencode(url: String): String;
|
||||
function openfs(filename: String): TFileStream;
|
||||
procedure StreamWrite(S: TStream; Text: WideString = '');
|
||||
function fixSQL( sql: WideString; sql_version: Integer = SQL_VERSION_ANSI; cli_workarounds: Boolean = false ): WideString;
|
||||
procedure ToggleCheckListBox(list: TTNTCheckListBox; state: Boolean); Overload;
|
||||
@ -201,7 +200,6 @@ type
|
||||
function GetDBObjectType(TableStatus: TMySQLQuery): TListNodeType;
|
||||
procedure SetWindowSizeGrip(hWnd: HWND; Enable: boolean);
|
||||
procedure SaveUnicodeFile(Filename: String; Text: WideString);
|
||||
function CreateUnicodeFileStream(Filename: String): TFileStream;
|
||||
procedure OpenTextFile(const Filename: String; out Stream: TFileStream; out FileCharset: TFileCharset);
|
||||
function GetFileCharset(Stream: TFileStream): TFileCharset;
|
||||
function ReadTextfileChunk(Stream: TFileStream; FileCharset: TFileCharset; ChunkSize: Int64 = 0): WideString;
|
||||
@ -1268,16 +1266,6 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
{***
|
||||
Create UTF-8 text file
|
||||
}
|
||||
function openfs(filename: String): TFileStream;
|
||||
begin
|
||||
Result := TFileStream.Create(filename, fmCreate);
|
||||
Result.WriteBuffer(sUTF8BOMString, 3);
|
||||
end;
|
||||
|
||||
|
||||
{**
|
||||
Write some UTF8 text to a file- or memorystream
|
||||
}
|
||||
@ -2364,23 +2352,12 @@ procedure SaveUnicodeFile(Filename: String; Text: WideString);
|
||||
var
|
||||
f: TFileStream;
|
||||
begin
|
||||
f := CreateUnicodeFileStream(Filename);
|
||||
f.WriteBuffer(Pointer(Text)^, Length(Text) * 2);
|
||||
f := TFileStream.Create(Filename, fmCreate or fmOpenWrite);
|
||||
StreamWrite(f, Text);
|
||||
f.Free;
|
||||
end;
|
||||
|
||||
|
||||
function CreateUnicodeFileStream(Filename: String): TFileStream;
|
||||
var
|
||||
header: array[0..1] of Byte;
|
||||
begin
|
||||
header[0] := $FF;
|
||||
header[1] := $FE;
|
||||
Result := TFileStream.Create(Filename, fmCreate or fmOpenWrite);
|
||||
Result.WriteBuffer(header, 2);
|
||||
end;
|
||||
|
||||
|
||||
{**
|
||||
Open a textfile unicode safe and return a stream + its charset
|
||||
}
|
||||
|
Reference in New Issue
Block a user