mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-05 07:49:10 -07: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:
parent
d7e55db99b
commit
cc293f90a2
3 changed files with 38 additions and 1 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue