Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds support for multiple character encodings (charsets) in the Mud client and introduces a new ENVIRONMENT variable for enabling development-specific features.
Supported Charsets
The Mud client now supports the following charsets:
- latin1 (ISO-8859-1)- ascii (US-ASCII)Charset conversion on the client-side is handled through the functionmapToServerEncodings
, which maps the client-used charsets to those supported by the server.How It Works
During the Telnet negotiation (TELOPT_CHARSET), the client checks which charsets are supported by the server.
The client's preferred charset (defined via the environment variable CHARSET)Only UTF-8 is compared against the charsets offered by the server. If the client's preferred charset is not supported,the client defaults to utf-8an error is thrown.Server-side Charset Check: During the Telnet charset negotiation, the client's preferred charset (e.g., utf-8, latin1, ascii) is checked against the charsets supported by the server.Fault Tolerance: If the server does not support the client's charset, the encoding defaults to utf-8, and a warning is logged.
New Environment Variable ENVIRONMENT
A new environment variable ENVIRONMENT has been introduced, which can be set to either "development" or "production" (default). This variable controls whether certain development-only features are enabled.
Validation: If ENVIRONMENT is set to anything other than "development" or "production", an error is thrown to ensure valid configuration.
Development Mode Debug Endpoints
When the environment is set to "development", debug REST endpoints are enabled. These endpoints provide information about the currently connected clients and their Telnet negotiations.
The /api/info endpoint provides a list of all active Telnet connections and their associated negotiation status.
This allows developers to monitor connected clients and inspect their negotiation status directly from the REST endpoint during development.
Fixes #111
Edit: The client is now fixed at "utf-8". The old CHARSET environment variable has been discarded.