Commit graph

1 commit

Author SHA1 Message Date
Eduardo Dantas
67460c09bb
refactor: string encoding to use utf8cpp and add tests (#1443)
Update string encoding implementation to use utf8cpp

This change updates the string encoding implementation to use the utf8cpp library for improved robustness and consistency across platforms. It refactors the encoding functions in src/framework/stdext/string.cpp, adds comprehensive unit tests, updates build configurations to include utf8cpp, and documents the new encoding policy and behavior.

String encoding improvements

Refactored all string encoding functions in src/framework/stdext/string.cpp to use the utf8cpp library, providing strict UTF-8 validation, robust conversions between UTF-8, Latin-1, and UTF-16, and consistent error handling.

Added a new documentation file docs/string-encoding-policy.md detailing the updated encoding policy, error handling, dependencies, and testing strategy.

Testing enhancements

Added a new unit test suite in tests/stdext/string_encoding_test.cpp covering UTF-8 validation, conversions, roundtrip consistency, control character handling, and platform-specific UTF-16 conversions.

Updated the test build configuration to include the new test directory and sources.

Build system updates

Updated src/CMakeLists.txt to require and link the utf8cpp library for all platforms, ensuring proper integration.

Added utf8cpp as a dependency in vcpkg.json for package management.
2025-11-20 02:08:02 -03:00