Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OCP4: use utf-8 as default xml encoding #11614

Merged
merged 1 commit into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build-scripts/build_xccdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def link_benchmark(loader, xccdftree, args, benchmark=None):
if ocil is not None:
link_ocil(xccdftree, checks, args.ocil, ocil)

ssg.xml.ElementTree.ElementTree(xccdftree).write(args.xccdf)
ssg.xml.ElementTree.ElementTree(xccdftree).write(args.xccdf, encoding="utf-8")


def get_path(path, file_name):
Expand Down
4 changes: 2 additions & 2 deletions build-scripts/compose_ds.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,10 +282,10 @@ def upgrade_ds_to_scap_13(ds):

def _store_ds(ds, output_13, output_12):
if output_12:
ds.write(output_12, xml_declaration=True)
ds.write(output_12, xml_declaration=True, encoding="utf-8")

ds_13 = upgrade_ds_to_scap_13(ds)
ds_13.write(output_13, xml_declaration=True)
ds_13.write(output_13, xml_declaration=True, encoding="utf-8")


def append_id_to_file_name(path, id_):
Expand Down
4 changes: 2 additions & 2 deletions ssg/build_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ def to_xml_element(self, env_yaml=None, product_cpes=None):
def to_file(self, file_name, env_yaml=None):
root = self.to_xml_element(env_yaml)
tree = ET.ElementTree(root)
tree.write(file_name)
tree.write(file_name, encoding="utf-8")

def add_value(self, value):
if value is None:
Expand Down Expand Up @@ -1590,7 +1590,7 @@ def export_ocil_to_file(self, filename):
if root is None:
return
tree = ET.ElementTree(root)
tree.write(filename, xml_declaration=True)
tree.write(filename, encoding="utf-8", xml_declaration=True)


class Platform(XCCDFEntity):
Expand Down
Loading