Skip to content

Conversation

@Mab879
Copy link
Collaborator

@Mab879 Mab879 commented Sep 28, 2025

Ensure all files are opened with UTF-8 instead of relying on OS defaults. This prevents UnicodeDecodeError on Windows and ensures consistent behavior across environments when parsing STIG data containing special characters.

Fix up of #184

Thanks to @PrzemyslawZabicki for the initial fix.

Summary by CodeRabbit

  • Bug Fixes
    • XML files are now read using UTF-8, preventing decode errors and garbled characters during import.
    • Improved handling of non-ASCII/international characters and symbols in STIG content.
    • Reduced import failures across different locales and operating systems.
    • More consistent, reliable imports with fewer unexpected crashes or warnings.
    • Enhances overall stability of the STIG import workflow without requiring user action.

Ensure all files are opened with UTF-8 instead of relying on OS defaults.
This prevents UnicodeDecodeError on Windows and ensures consistent behavior across environments when parsing STIG data containing special characters.
@coderabbitai
Copy link

coderabbitai bot commented Sep 28, 2025

Walkthrough

Enforces UTF-8 decoding when reading STIG XML by adding encoding="utf-8" to open() in stigaview_static/import_stig.py. No other logic or interfaces changed.

Changes

Cohort / File(s) Summary of Changes
File I/O encoding update
stigaview_static/import_stig.py
Added explicit UTF-8 encoding to file opening in get_root_from_xml_path; XML parsing flow unchanged.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

I nibbled bytes in UTF-8 delight,
No mojibake to give me a fright.
XML leaves rustle, clean and bright,
Parsers hop smoothly through the night.
Carrots for code that reads just right! 🥕✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title “fix: open STIG files with explicit UTF-8 encoding” directly summarizes the core change of adding UTF-8 decoding when opening STIG files, is concise and free of extraneous details, and clearly communicates the intent of the patch to readers.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 8a7a579 and 1df5fab.

📒 Files selected for processing (1)
  • stigaview_static/import_stig.py (1 hunks)
🔇 Additional comments (1)
stigaview_static/import_stig.py (1)

95-96: UTF-8 enforcement looks good.

Explicitly specifying UTF-8 here prevents platform-dependent decoding and aligns with the PR goal to avoid Windows decode errors. Nice fix.

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • UTF-8: Entity not found: Issue - Could not find referenced Issue.

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants