Modify ↓
Opened on Apr 1, 2026 at 9:08:02 PM
Last modified on Apr 1, 2026 at 11:15:10 PM
#4086 new Bug
Bug with IniReadSectionNames if file is coded with UTF-8-BOM
| Reported by: | anonymous | Owned by: | |
|---|---|---|---|
| Milestone: | Component: | AutoIt | |
| Version: | 3.3.18.0 | Severity: | None |
| Keywords: | Cc: |
Description (last modified by )
I have an ini-file that is formatted with UTF-8-BOM. If the file does not start with a linebreak, IniReadSectionNames does not retrieve the first section.
Local $sPathA, $sPathB, $sPathC, $sPathD, $hFile ; File A - UTF-8-BOM - No Leading LineBreak $sPathA = @DesktopDir & "\File_UTF-8-BOM_v1.ini" $hFile = FileOpen($sPathA, 2 + 8 + 128) FileWrite($hFile, "[SectionA]" & @CRLF & "Key=Value") FileClose($hFile) ; File B - UTF-8-BOM - Leading LineBreak $sPathB = @DesktopDir & "\File_UTF-8-BOM_v2.ini" $hFile = FileOpen($sPathB, 2 + 8 + 128) FileWrite($hFile, @CRLF & "[SectionB]" & @CRLF & "Key=Value") FileClose($hFile) ; File C - UTF-8 - No Leading LineBreak $sPathC = @DesktopDir & "\File_UTF-8_v1.ini" $hFile = FileOpen($sPathC, 2 + 8 + 256) FileWrite($hFile, "[SectionA]" & @CRLF & "Key=Value") FileClose($hFile) ; File D - UTF-8 - Leading LineBreak $sPathD = @DesktopDir & "\File_UTF-8_v2.ini" $hFile = FileOpen($sPathD, 2 + 8 + 256) FileWrite($hFile, @CRLF & "[SectionB]" & @CRLF & "Key=Value") FileClose($hFile) Local $aSectionA = IniReadSectionNames($sPathA) Local $aSectionB = IniReadSectionNames($sPathB) Local $aSectionC = IniReadSectionNames($sPathC) Local $aSectionD = IniReadSectionNames($sPathD) ConsoleWrite("$aSectionA" & @TAB & UBound($aSectionA) & @CRLF) ConsoleWrite("$aSectionB" & @TAB & UBound($aSectionB) & @CRLF) ConsoleWrite("$aSectionC" & @TAB & UBound($aSectionC) & @CRLF) ConsoleWrite("$aSectionD" & @TAB & UBound($aSectionD) & @CRLF) Exit
Attachments (0)
Change History (3)
comment:2 by , on Apr 1, 2026 at 10:23:44 PM
| Description: | modified (diff) |
|---|
comment:3 by , on Apr 1, 2026 at 11:09:17 PM
@JPM please also read:
Version 0, edited on Apr 1, 2026 at 11:09:17 PM by (next)
Note:
See TracTickets
for help on using tickets.

see discussion at https://www.autoitscript.com/forum/topic/213616-bug-with-inireadsectionnames-if-file-is-coded-with-utf-8-bom/#comment-1551213