{
  "slug": "k6-textencoder-and-textdecoder-globals-0a7628d52132",
  "title": "k6 TextEncoder and TextDecoder globals",
  "tools": [
    "k6"
  ],
  "tags": [
    "agent"
  ],
  "introduced_at": "2026-08-10T14:01:35.000Z",
  "announced_at": "2026-08-10T14:01:35.000Z",
  "effective_at": null,
  "date_basis": "source-publication",
  "status": "unknown",
  "how": {
    "incantation": "When a k6 script must encode or decode text, use the `TextEncoder` and `TextDecoder` globals directly in init or VU code. No import is required.",
    "examples": [
      "const encoded = new TextEncoder().encode('Hello, world!');\nconst decoded = new TextDecoder().decode(encoded);"
    ],
    "gotchas": [
      "Version: v2.2.0",
      "Prerequisite: Use k6 v2.2.0 or later; the release note says these globals are available in both init and VU contexts.",
      "Available as globals in both the init and VU contexts."
    ]
  },
  "why_it_matters": "When encoding or decoding text in a k6 script, use the standard encoder and decoder globals in init or VU code.",
  "sources": [
    "https://github.com/grafana/k6/releases/tag/v2.2.0"
  ],
  "rank": 0.96026,
  "judge": {
    "publish": true,
    "judge_model": "codex-cli/gpt-6-luna+typesafe/jev-1.13.0",
    "prompt_version": "extract-v7+enrich-v2+judge-v2x3+jev-publish-v1"
  },
  "review_state": "approved",
  "provenance": {
    "run_id": "wave2a-20261017",
    "verdict_id": "wave2a-20261017:wave2a-20261017-c50b860ccf230af2-2:gate",
    "evidence_hash": "5029169f942862caa4fcc22c402f7f04b7ddcfb75af24cf8ee5e89a592ecd7bf"
  },
  "review": {
    "draft_hash": "3718086fd7432c10669b04b69ca2997b22a2f8aec7e04f86a88476a402daa5dc",
    "reviewer": "publication-gate",
    "reviewed_at": "2026-10-07T00:00:00.000Z",
    "decision": "wave2a-20261017:gate",
    "reason": "3 of 3 judge runs approved with p_yes >= 0.9 (mean 0.96 >= 0.9; 2 needed) and Jev gave 0.70 (>= 0.6 needed)."
  }
}
