Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YAML compile cache: encoding aware symbols #398

Merged
merged 1 commit into from
Jan 28, 2022
Merged

Conversation

casperisfine
Copy link
Contributor

@casperisfine casperisfine commented Jan 28, 2022

Ref: msgpack/msgpack-ruby#211

The default msgpack Symbol packer/unpacker is not encoding, aware which cause all non-ASCII symbols to be unpacked with ASCII-8BIT encoding aka BINARY.

So we define a custom packer that prefix the symbol name with 1 for UTF-8 symbols, and 0 for the others (ASCII or binary).

If Encoding.default_internal is set to something MessagePack doesn't support, we entirely disable the YAML cache.

@casperisfine casperisfine force-pushed the symbol-encoding branch 3 times, most recently from f0304dd to 47c443a Compare January 28, 2022 12:34
Ref: msgpack/msgpack-ruby#211

The default msgpack Symbol packer/unpacker is not encoding
aware which cause all non-ASCII symbols to be unpacked with
ASCII-8BIT encoding aka BINARY.

So we define a custom packer that prefix the symbol name with `1`
for UTF-8 symbols, and `0` for the others (ASCII or binary)

If `Encoding.default_internal` is set to something MessagePack
doesn't support, we entirely disable the YAML cache.
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.

None yet

2 participants