Config::Tiny does not work with UTF8 encoded INI with Byte Order Marks#1
Open
Outworldz wants to merge 98 commits into
Open
Config::Tiny does not work with UTF8 encoded INI with Byte Order Marks#1Outworldz wants to merge 98 commits into
Outworldz wants to merge 98 commits into
Conversation
Users may now say Config::Tiny->new($hashref) to bless this hashref into the package and turn it into a Config::Tiny object.
Add ability to pass a hashref to constructor
Do not use bareword file handles when opening files for read/write.
…s not yet been released)
…s not yet been released)
Remove unnecessary Test::Pod dependency again
Add arrays, defined with the characters "[]" after a key name
Fix LGPL name in LICENSE file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Nice module, thanks!
I spotted a glitch on Windows 11 using Strawberry Perl.
Edit:: It appears this is a common problem in Perl core. I was able to workaround it using File::BOM in my Perl code.
UTF-8 chars in a plain ASCII file works in Config::Tiny when I read it as UTF8 without the BOM. If there is a BOM it aborts.
I have UTF-8 in my INIs. My servers already have BOM's in the file. BOM is the (hexadecimal) byte sequence 0xEF,0xBB,0xBF. They were written using standard Dot Net encoding as UTF-8, which adds the BOM to the beginning.
I am reading it like this:
Error is:
When I edit and save the file without the BOM, it will work, even with UTF-8 in the file later.
I can cure this by not writing the Byte Order Mark at the beginning of the file:
Its not possible for me to workaround by cleaning the INI of BOMs as I use other Dot Net INI Nuget modules to manipulate the INI, and always end up back with the BOM issue.
tl;dr
Writing INI as UTF8 fails due to BOM.
Writing INI as UTF8 without a BOM works.
Encoding INI as ASCII and reading it as UTF-8 works. (Encoding.ASCII)
Changing the UTF-8 file by deleting the BOM works, even with UTF-8 in it.
UTF-8 chars in the plain ASCII file works in Config::Tiny when I read it as UTF8 without the BOM.