mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 13:22:48 +00:00
ini_file - opening file as utf-8-sig (#2578)
* opening file as utf-8-sig * added changelog fragment * using io.open() * Update tests/integration/targets/ini_file/tasks/main.yml Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
@@ -104,6 +104,7 @@ EXAMPLES = r'''
|
||||
backup: yes
|
||||
'''
|
||||
|
||||
import io
|
||||
import os
|
||||
import re
|
||||
import tempfile
|
||||
@@ -141,7 +142,7 @@ def do_ini(module, filename, section=None, option=None, value=None,
|
||||
os.makedirs(destpath)
|
||||
ini_lines = []
|
||||
else:
|
||||
with open(filename, 'r') as ini_file:
|
||||
with io.open(filename, 'r', encoding="utf-8-sig") as ini_file:
|
||||
ini_lines = ini_file.readlines()
|
||||
|
||||
if module._diff:
|
||||
|
||||
Reference in New Issue
Block a user