X Tutup
Skip to content

[23.0 backport] daemon/config: support alternate (common) unicode encodings using a BOM#44832

Merged
neersighted merged 3 commits intomoby:23.0from
thaJeztah:23.0_backport_wide_json
Jan 18, 2023
Merged

[23.0 backport] daemon/config: support alternate (common) unicode encodings using a BOM#44832
neersighted merged 3 commits intomoby:23.0from
thaJeztah:23.0_backport_wide_json

Conversation

@thaJeztah
Copy link
Member

backports;


- What I did
Instead of merely stripping a UTF-8 BOM, interpret UTF-8 and UTF-16 BOMs in order to support the common encodings on Windows.

This is a pragmatic but impure choice, in order to better support the default tools available on Windows Server, and reduce user confusion due to otherwise inscrutable-to-the-uninitiated errors like the following:

invalid character 'þ' looking for beginning of value
invalid character 'ÿ' looking for beginning of value

While meaningful to those who are familiar with and are equipped to diagnose encoding issues, these characters will be hidden when the file is edited with a BOM-aware text editor, and further confuse the user.

- How I did it

- How to verify it
Unit tests

- Description for the changelog

  • Moby now supports UTF-16 encoded JSON configuration when a byte order mark is present
  • Moby will report invalid UTF-8 in the JSON configuration early and comprehensibly

- A picture of a cute animal (not mandatory but encouraged)
image

Signed-off-by: Bjorn Neergaard <bneergaard@mirantis.com>
(cherry picked from commit 1dcf7d5)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This is a pragmatic but impure choice, in order to better support the
default tools available on Windows Server, and reduce user confusion due
to otherwise inscrutable-to-the-uninitiated errors like the following:

> invalid character 'þ' looking for beginning of value
> invalid character 'ÿ' looking for beginning of value

While meaningful to those who are familiar with and are equipped to
diagnose encoding issues, these characters will be hidden when the file
is edited with a BOM-aware text editor, and further confuse the user.

Signed-off-by: Bjorn Neergaard <bneergaard@mirantis.com>
(cherry picked from commit d424950)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
…TF-8

This helps ensure that users are not surprised by unexpected tokens in
the JSON parser, or fallout later in the daemon.

Signed-off-by: Bjorn Neergaard <bneergaard@mirantis.com>
(cherry picked from commit 8dbc5df)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@thaJeztah thaJeztah added platform/windows status/2-code-review kind/enhancement Enhancements are not bugs or new features but can improve usability or performance. area/daemon Core Engine labels Jan 17, 2023
@thaJeztah thaJeztah added this to the 23.0.0 milestone Jan 17, 2023
@thaJeztah
Copy link
Member Author

@neersighted ptal 🤗

@neersighted neersighted merged commit 110a9ea into moby:23.0 Jan 18, 2023
@thaJeztah thaJeztah deleted the 23.0_backport_wide_json branch January 18, 2023 08:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/daemon Core Engine impact/changelog kind/enhancement Enhancements are not bugs or new features but can improve usability or performance. platform/windows status/2-code-review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

X Tutup