Jump to content

Recommended Posts

Posted (edited)

IniRead()/IniWrite() cannot read/write ini File encoded by utf8 with BOM. And they also cannot read/write ini file encoded by Unicode big endian.

Please fix this bug.

Autoit Version:3.3.6.1

Edited by happytc
Posted (edited)

$str1 = IniRead(@ScriptDir & "\UnicodeBigEndian.ini", "Test", "First", "")
$str2 = IniRead(@ScriptDir & "\UTF8BOM.ini", "Test", "First", "")
MsgBox(0,"UnicodeBigEndian", $str1)
MsgBox(0,"UTF8BOM", $str2)

Edited by happytc
Posted

I don't think it's a bug.

Or do "real" Inifiles actually support utf8?

Oh, Maybe it's not a bug.

OK, Please add this functionality of reading/writing INI file encoded by UTF8 with BOM and Unicode-big-endian

  • 11 months later...
Posted (edited)

Oh, Maybe it's not a bug.

OK, Please add this functionality of reading/writing INI file encoded by UTF8 with BOM and Unicode-big-endian

for me it is a bug! ^____^

I need a way to save configuration and most recent files/bookmarks in an ini file, so it can contain unicode paths and filenames, and I need to permit to change that configuration manually, not using an autoit script but an external program (notepad or any other).

please help me! :-)

Local $f1, $f2

MsgBox(0, "0: simple", "PROGRAM_PARAMETER_01=""attività"""); OK

$f1=IniRead("UserSettingstest.ini", "Operation ORARI", "PROGRAM_PARAMETER_01", ""); the value is: PROGRAM_PARAMETER_01=""attività""
MsgBox(0, "1: read ini", $f1); NOK

$f1="PROGRAM_PARAMETER_01=""attività"""
MsgBox(0, "2: variable", $f1); OK

IniWriteSection("UserSettingstest.ini", "Operation ORARI 2", $f1);NOK
$f2=IniRead("UserSettingstest.ini", "Operation ORARI 2", "PROGRAM_PARAMETER_01", "")
MsgBox(0, "3: read ini written variable", $f2); OK
Edited by filobus
Posted

You'll have to implement your own functions using FileRead / FileWrite, because INI files are by specification ASCII coded.

BTW: It's not a good idea to respond to old topics. You could have opened your own ;)

Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]
Posted

The "right" way to do that is to use the registry. If you insist on .ini files, note that even if MS provides both ANSI and Unicode versions of the fonctions, they don't enforce Unicode encoding.

http://blogs.msdn.com/b/michkap/archive/2006/09/15/754992.aspx

So what you need to do is encode your section, key and value strings in UTF-8 and store that as if it was ANSI. That can't make the standard function behave strangely UNLESS you share this ini file with application not aware that sections, keys and values actually are UTF-8.

Note that the ini file is itself an ANSI file (no UTF-8 BOM).

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...