Skip to content

Commit

Permalink
Allow encoding UTF-8 in JSON files
Browse files Browse the repository at this point in the history
  • Loading branch information
hughsie committed Dec 6, 2024
1 parent abca99d commit 6ce86d2
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion uswid/format_cyclonedx.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ def save(self, container: uSwidContainer) -> bytes:
if dependencies:
root["dependencies"] = dependencies

return json.dumps(root, indent=2).encode()
return json.dumps(root, indent=2, ensure_ascii=False).encode()

def _save_component(self, component: uSwidComponent) -> Dict[str, Any]:
root: Dict[str, Any] = {}
Expand Down
2 changes: 1 addition & 1 deletion uswid/format_goswid.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def save(self, container: uSwidContainer) -> bytes:
root = []
for component in container:
root.append(self._save_component_internal(component))
return json.dumps(root, indent=2).encode()
return json.dumps(root, indent=2, ensure_ascii=False).encode()

def _save_link(self, link: uSwidLink) -> Dict[str, str]:
"""Exports a uSwidLink goSWID section"""
Expand Down
2 changes: 1 addition & 1 deletion uswid/format_spdx.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def save(self, container: uSwidContainer) -> bytes:
if packages:
root["packages"] = packages

return json.dumps(root, indent=2).encode()
return json.dumps(root, indent=2, ensure_ascii=False).encode()

def _save_component(self, component: uSwidComponent) -> Dict[str, Any]:
root: Dict[str, Any] = {}
Expand Down

0 comments on commit 6ce86d2

Please sign in to comment.