Skip to content

fix: std.manifestToml passes through Unicode characters natively#1018

Open
He-Pin wants to merge 2 commits into
databricks:masterfrom
He-Pin:fix/toml-unicode-escape
Open

fix: std.manifestToml passes through Unicode characters natively#1018
He-Pin wants to merge 2 commits into
databricks:masterfrom
He-Pin:fix/toml-unicode-escape

Conversation

@He-Pin

@He-Pin He-Pin commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

fix: std.manifestToml passes through Unicode characters natively

Motivation

TomlRenderer hardcoded unicode = true, causing all non-ASCII characters to be escaped as \uXXXX in TOML output. C++ jsonnet, go-jsonnet, and jrsonnet all pass through Unicode characters directly. Companion to PR #1017.

Modification

  • TomlRenderer.scala: Changed unicode from true to false in visitString (line 54) and writeEscapedKey (line 164).
  • Updated UnicodeHandlingTests.objectFieldOrdering expectation.
  • Added regression test: toml_unicode_native_output.jsonnet

Result

Expression cpp-jsonnet go-jsonnet jrsonnet sjsonnet (before) sjsonnet (after)
manifestToml({name: "世界"}) name = "世界" name = "世界" name = "世界" name = "\u4e16\u754c" name = "世界"
manifestToml({drink: "café"}) drink = "café" drink = "café" drink = "café" drink = "caf\u00e9" drink = "café"

He-Pin added 2 commits June 24, 2026 11:48
Motivation:
TomlRenderer hardcoded unicode = true, causing all non-ASCII
characters to be escaped as \uXXXX sequences. C++ jsonnet passes
through Unicode characters directly in TOML output.

Modification:
- TomlRenderer.scala: Change unicode from true to false in both
  visitString (line 54) and writeEscapedKey (line 164).
- UnicodeHandlingTests.scala: Update objectFieldOrdering test
  expectation to use native Unicode instead of escaped form.

Result:
std.manifestToml({name: "世界"}) now outputs name = "世界"
instead of name = "\u4e16\u754c", matching C++ jsonnet.
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.

1 participant