Skip to content

Conversation

mslavov
Copy link

@mslavov mslavov commented Aug 7, 2025

Description

This PR introduces configurable database character set support for MariaDB connections,
allowing users to specify the character encoding used for their database connections
through an environment variable.

Changes

  • feat: Added DB_CHARSET environment variable configuration
  • refactor: Improved charset handling in connection pool initialization to make it
    optional
  • docs: Updated README.md to document the new configuration option

Implementation Details

  1. Configuration Enhancement - Introduced DB_CHARSET as an optional environment variable
    that can be set to specify the database connection character set
  2. Connection Pool Updates - Modified the MariaDB server initialization to:
    - Conditionally include charset in connection parameters only when specified
    - Enhanced logging to clearly indicate whether a charset is configured
  3. Documentation - Added the new configuration option to the README for user reference

Benefits

  • Provides flexibility for users working with databases that require specific character
    encodings
  • Maintains backward compatibility by making the charset optional (no default enforced)
  • Improves transparency through enhanced logging

Testing

The changes have been tested with:

  • Connection without DB_CHARSET specified (charset omitted from connection)
  • Connection with DB_CHARSET set to a value: cp1251

Breaking Changes

None - this is a backward-compatible enhancement.

- Introduced DB_CHARSET environment variable with a default value of "utf8mb4"
- Updated connection pool logging to include charset information
- Enhanced MariaDBServer initialization to utilize the charset setting
- Removed default value for DB_CHARSET in configuration
- Updated connection pool initialization to conditionally include charset in parameters
- Enhanced logging to reflect whether charset is set or not
@mariadb-RyanKillea
Copy link
Contributor

Thank you for the contribution!

@mariadb-RyanKillea mariadb-RyanKillea merged commit e09446f into MariaDB:main Sep 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants