It is not that easy!
The code above might work if String maps to an AnsiString,
however fails if String maps to a UnicodeString ( Delpi 2009 ).
This little modification does the job in D2009
uses rtlconsts;
...
procedure TMyUnicodeIniFile.WriteString(const Section, Ident, Value:
RTT wrote:
It is not that easy!
The code above might work if String maps to an AnsiString,
however fails if String maps to a UnicodeString ( Delpi 2009 ).
This little modification does the job in D2009
uses rtlconsts;
...
procedure TMyUnicodeIniFile.WriteString(const Section, Ident,
Yes, that should work and is the bare minimum required for use
in the demos. Though it cannot handle a possible BOM.
With a little trick and we just need to rewrite the create constructor.
unit UnicodeIniFile;
interface
type
TMyUnicodeIniFile = class(TIniFile)
public
constructor
RTT wrote:
Yes, that should work and is the bare minimum required for use
in the demos. Though it cannot handle a possible BOM.
With a little trick and we just need to rewrite the create
constructor.
unit UnicodeIniFile;
interface
type
TMyUnicodeIniFile = class(TIniFile)
public
The D2009 TInitFile already uses the WritePrivateProfileStringW and
GetPrivateProfileStringW versions of the functions, but only work if
the ini file already exists and is Unicode.
Surprise! That works indeed with UTF-16, however if there is a UTF-8
BOM and data I cannot read a
RTT wrote:
The D2009 TInitFile already uses the WritePrivateProfileStringW and
GetPrivateProfileStringW versions of the functions, but only work if
the ini file already exists and is Unicode.
Surprise! That works indeed with UTF-16, however if there is a UTF-8
BOM and data I cannot read a
As I wrote in my previous message, this does not work for me.
Whenever Windows finds an UTF-8 BOM it does not return a single byte.
Sorry, I have not understood.
For me, the previous code works fine in Vista and XP.
I change the encode of the ini file using Notepad from UTF16 to UTF8,
and
Arno Garrels wrote:
function TMyUnicodeIniFile.ReadString(const Section, Ident, Default:
string): string;
begin
result := inherited;
if fIsUTF8 then
result := utf8decode(result)
end;
As I wrote in my previous message, this does not work for me.
Whenever Windows finds an UTF-8 BOM
My fault, now it works. But it won't be the same level of backwards
compatibility that can be achieved with a class derived from TCustomIniFile.
Can you, please, point one possible problem?
--
To unsubscribe or change your settings for TWSocket mailing list
please goto
It is also important that the INI file generated by D2009 compiled
application remains compatible with the same application compiled with
older
Delphi as long as it is possible (This is not possible if a value stored
in
the INI file cannot be represented properly as an ansi character. See
Old Delphi saved ini files will open correctly in D2009 compiled demo too.
It is also important that the INI file generated by D2009 compiled
application remains compatible with the same application compiled with older
Delphi as long as it is possible (This is not possible if a value
Old Delphi saved ini files will open correctly in D2009 compiled demo too.
It is also important that the INI file generated by D2009 compiled
application remains compatible with the same application compiled with older
Delphi as long as it is possible (This is not possible if a value stored in
RTT wrote:
My fault, now it works. But it won't be the same level of backwards
compatibility that can be achieved with a class derived from
TCustomIniFile.
Can you, please, point one possible problem?
If you derive something like the TMemInFile that writes all data in
one call to a method
If you derive something like the TMemInFile that writes all data in
one call to a method UpdateFile it's possible to add a BOM or not
depending on the data itself. You can read a BOM-marked UTF-8 INI +
file, change it and write it back as Ansi or plain Ascii without BOM
if encoding is no
14 matches
Mail list logo