Skip to content

raw tagged template literals show escapes for non ascii text #8745

Open

Description

@small-angel

What version of Bun is running?

No response

What platform is your computer?

No response

What steps can reproduce the bug?

function what({ raw }) {
  console.log(raw)
}

what`弟気`

What is the expected behavior?

[ '弟気' ]

What do you see instead?

[ "\\u5F1F\\u6C17" ]

Additional information

Related: #7540

Activity

  1. drewlesueur commented on Apr 5, 2024

    @drewlesueur

    A similar issue (#9891) seems to be fixed in v1.1.1, however this specific issue is still there.

  2. added a commit that references this issue on Feb 19, 2026
    9a7d4b4
  3. added a commit that references this issue on Feb 20, 2026
    35a039c
  4. added a commit that references this issue on Mar 18, 2026
    57a6c65
  5. added a commit that references this issue on Apr 21, 2026
    8b258cb
  6. added a commit that references this issue on May 7, 2026
    dd96ba8
  7. added 4 commits that reference this issue on May 17, 2026
    8aeaed8
    4cadcde
    a31592f
    667e9ff
  8. added a commit that references this issue on Aug 1, 2026
    2a1a2d0
  9. removed their assignment
    on Aug 4, 2026
  10. added 2 commits that reference this issue on Aug 13, 2026
    264b81a
    90fd0c9
  11. marked Non-ASCII bug on Bun Shell #12225 as a duplicate of this issue on Aug 15, 2026
  12. hishtadlut commented on Aug 23, 2026

    @hishtadlut

    Still reproducible with Bun 1.4.0 (34cbb9a), Windows x64.

    Here is a minimal BDD-style regression:

    import { describe, expect, test } from "bun:test";
    
    describe("String.raw with non-ASCII source text", () => {
      test("Given a literal check mark, when String.raw evaluates it, then the character is preserved", () => {
        expect(String.raw`✓`).toBe("✓");
      });
    });

    Bun 1.4.0 fails with a received value of "\\u2713"; Node preserves "✓".

    This has a visible CSS consequence. Given:

    const css = String.raw`.done::before { content: "✓"; }`;

    Bun emits a JavaScript-style \\u2713 escape. CSS does not interpret that as a JavaScript Unicode escape, so the browser displays u2713 instead of the check mark. Switching that stylesheet to an ordinary template literal is an effective application-level workaround.

  13. franciscop commented on Aug 23, 2026

    @franciscop

    I just found this by exactly hitting the bug with (String.raw`✓`) as well, happy to see it's already reported 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtranspilerparser || printer

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions