Skip to content

Conversation

@techthoughts2
Copy link
Contributor

Pull Request

This pull request adds basic generic improvements to this repository project.

  • The Read the docs improvements will enable your project to be built on Python 3 and will result in faster, and more stable integration with Read the docs.
  • General spelling improvements
  • Corrected duplication of CHANGELOG
  • Removed un-used theme files

Module builds without issue. Read the docs tested and verified in forked build.

Issue

N/A

Detailed Description of Changes

  • Module Changes:
    • Minor spelling corrections throughout
  • Build Changes:
    • Minor spelling corrections throughout
    • CHANGELOG improvements:
      • Updated CHANGELOG to pass markdown linter, remove duplicate titles, and increase readability
      • Removed duplicate copy of additional CHANGELOG that contained outdated information
      • Placed CHANGELOG in correct location so that Read the docs can correctly display the correct CHANGELOG
    • Improved Read the docs integration by moving to Python 3 based build
  • Repo changes:
    • Removed un-used theme files
    • Updated LICENSE year

License

By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.

@austoonz
Copy link
Owner

austoonz commented Mar 2, 2023

Thanks Jake! :D

@austoonz austoonz merged commit 30ba7e4 into austoonz:master Mar 2, 2023
austoonz added a commit that referenced this pull request Jan 30, 2026
- ConvertTo-Celsius and ConvertTo-Fahrenheit now accept -Precision (0-15)
- Default remains 2 decimal places for practical use
- Higher precision available for scientific calculations (e.g., absolute zero)
- Rust returns full f64 precision, PowerShell handles rounding
- Updated INCONSISTENCIES.md to mark item #5 as resolved
austoonz added a commit that referenced this pull request Jan 31, 2026
* Fix binary data handling in byte-to-string conversions (fixes #24)

Add lenient mode for handling non-UTF8 binary data (e.g., certificates, images):
- When no encoding is specified, use Latin-1 fallback for invalid UTF-8 bytes
- When encoding is explicitly provided, use strict mode (throws on invalid)
- Replace null bytes with Unicode replacement character (U+FFFD) for C string safety

Rust changes:
- Add bytes_to_string_lenient, base64_to_string_lenient, decompress_string_lenient FFI functions
- Update convert_bytes_to_string_with_fallback to handle null byte replacement

PowerShell changes:
- Update ConvertFrom-ByteArrayToString, ConvertFrom-Base64ToString, ConvertFrom-CompressedByteArrayToString
- Add DllImport declarations for lenient functions in RustInterop.ps1

This allows commands like 'Get-SecureBootUEFI db | ConvertFrom-ByteArrayToString' to work
without throwing 'Invalid UTF-8 bytes' errors.

* Remove default Encoding parameter values for future extensibility

Move encoding defaults from parameter declarations to internal handling:
- Allows detection of whether user explicitly specified an encoding
- Enables future best-effort improvements when encoding is not provided
- All functions now use internal 'if ([string]::IsNullOrEmpty(\)) { \ = ''UTF8'' }'

Updated functions:
- ConvertFrom-Base64, ConvertFrom-MemoryStream, ConvertFrom-MemoryStreamToString
- ConvertFrom-MemoryStreamToSecureString, ConvertFrom-StringToBase64
- ConvertFrom-StringToByteArray, ConvertFrom-StringToCompressedByteArray
- ConvertFrom-StringToMemoryStream, ConvertTo-Base64, ConvertTo-Hash
- ConvertTo-HmacHash, ConvertTo-MemoryStream

* docs: clarify lenient/strict encoding behavior for byte-to-string functions

- Update ConvertFrom-ByteArrayToString help to explain UTF-8 with Latin-1 fallback when -Encoding not specified
- Update ConvertFrom-Base64ToString help with same lenient/strict behavior documentation
- Fix ConvertFrom-CompressedByteArrayToString incorrect synopsis (was backwards) and add encoding docs
- Regenerate markdown documentation
- Add INCONSISTENCIES.md tracking document for standardization work

* fix: add error messages to URL functions for consistency

url_encode and url_decode now call set_error() when input is null,
matching the error handling pattern used by all other Rust functions.

* refactor: remove duplicate convert_string_to_bytes from hash module

hash.rs now uses crate::base64::convert_string_to_bytes() instead of
maintaining its own copy of the encoding conversion logic.

* Add -Precision parameter to temperature conversion functions

- ConvertTo-Celsius and ConvertTo-Fahrenheit now accept -Precision (0-15)
- Default remains 2 decimal places for practical use
- Higher precision available for scientific calculations (e.g., absolute zero)
- Rust returns full f64 precision, PowerShell handles rounding
- Updated INCONSISTENCIES.md to mark item #5 as resolved

* Standardize encoding conversions on Rust

- Add compute_hmac_with_encoding for string input with encoding parameter
- Add compute_hmac_bytes for direct byte array input (no encoding needed)
- Remove unused compute_hmac function
- Update ConvertTo-HmacHash to use new Rust functions
- Update ConvertFrom-StringToMemoryStream to use Rust string_to_bytes
- Fix bug: non-compress path now respects -Encoding parameter
- Fix bug: GzipStream now properly closed
- Update tests for correct behavior
- Mark INCONSISTENCIES.md issue #4 as resolved

* Fix encoding issues in ConvertFrom-ByteArrayToString tests

- Replace Unicode arrow character with ASCII in test name
- Use [char]::ConvertFromUtf32(0x1F30D) instead of literal emoji
  to avoid file encoding corruption issues

* Various fixes and improvements

- Update build.ps1 and RustInterop.ps1
- Fix compression.rs in Rust library
- Update Base64 conversion functions
- Fix ConvertTo-MemoryStream and RustInterop tests
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