Details
-
Bug
-
Resolution: Done
-
P2: Important
-
4.7.4, 4.8.4, 5.0.1, 5.1.0 RC1
-
None
-
Windows
Description
QSettings can not handle .ini files with UTF-8 BOM marker at the beginning (0xEF 0xBB 0xBF). For example, when reading file:
<EF><BB><BF>[section1]
foo1=bar1
[section2]
foo2=bar2
the parameters read by QSettings are:
foo1=bar
section2/foo2=bar
i.e. the first section line is ignored. If I insert a blank line at the beginning of the file:
<EF><BB><BF>
[section1]
foo1=bar1
[section2]
foo2=bar2
then QSettings gives the expected result
section1/foo1=bar
section2/foo2=bar
The problem occurs identically in cases when I call setIniCodec("UTF-8") or do not make the call.
While UTF-8 BOM marker is uncommon and not really useful, some instruments (especially in Windows) create files with it. Well, even Qt Creator supports writing UTF-8 BOM. Ignoring the problem and silently failing is not an option in this case.
Attachments
Issue Links
- relates to
-
QTBUG-133804 Qt 5 and Qt 6 both use QtProject.conf, but in an incompatible way
-
- Open
-
For Gerrit Dashboard: QTBUG-23381 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
93658,5 | Properly detect UTF-8 BOM markers in ini files | 5.4 | qt/qtbase | Status: MERGED | +2 | 0 |