Add option to disable emojis in code generation

Status Closed — not planned
Maintainer reply None cached
Activity 11 comments · opened Sep 14, 2025 · closed Feb 27, 2026

Preflight Checklist

  • [x] I have searched existing requests and this feature hasn't been requested yet
  • [x] This is a single feature request (not multiple features)

Problem Statement

Feature Request: Emoji-free Code Generation Option

### Problem
When generating Python code, Claude Code frequently includes emoji characters in:

  • print statements
  • comments
  • string literals

This causes UnicodeEncodeError on Windows systems using cp1252 encoding:
UnicodeEncodeError: 'charmap' codec can't encode character '\U0001f393'
in position 0: character maps to

Proposed Solution

Add a setting/option to disable emoji usage in all code generation, ensuring:

  • Clean, professional code output
  • Windows compatibility
  • No encoding issues

Alternative Solutions

_No response_

Priority

Medium - Would be very helpful

Feature Category

Configuration and settings

Use Case Example

Professional development environments where:

  • Code needs to run on various systems
  • Emoji-free output is preferred
  • Encoding compatibility is critical

Thank you for considering this feature request!

Additional Context

_No response_

View original on GitHub ↗

11 Comments

github-actions[bot] · 11 months ago

Found 2 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/2978
  2. https://github.com/anthropics/claude-code/issues/5058

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

coygeek · 11 months ago

Hey, this is a great point. I've run into similar encoding issues on Windows before. It's definitely frustrating when generated code doesn't run out of the box because of an unexpected emoji.

I was curious and dug into the official documentation you were given. It looks like the model is actually instructed not to use emojis unless explicitly asked.

The unpublished system prompt for claude code v1.0.113 includes these lines:

Only use emojis if the user explicitly requests it. Avoid using emojis in all communication unless asked.

And for tools that modify files, like Write and Edit, it repeats the instruction:

Only use emojis if the user explicitly requests it. Avoid writing emojis to files unless asked.

So, your experience seems to be a case of the model not following its instructions perfectly, which makes this a really good bug report.

While we wait for an official setting, I've had a lot of success using the CLAUDE.md memory file to add stricter, project-specific rules. You could create a file in your project root at ./CLAUDE.md (or for all your projects at ~/.claude/CLAUDE.md) with a strong directive like this:

# Code Generation Rules

- IMPORTANT: Under NO circumstances should you ever use emoji characters in your responses or in any code you generate.
- All code must be compatible with standard ASCII and UTF-8 environments and must not include special Unicode characters like emojis.

According to the memory docs, Claude loads this file into its context for every session in that project. I've found it's pretty good at following these kinds of explicit overrides.

It's not a perfect solution, but it should solve the UnicodeEncodeError for you in the meantime. Hope this helps

dimension-zero · 11 months ago

Claude Code's emoji-spam and hyperbolic language are a serious problem that negatively impacts development quality:

  1. The longer a chat thread, the more Claude Code reuses existing language patterns: emojis beget _more_ emojis, hyped-up language generates _more_ hype.
  2. Said pattern-matching builds a self-constructed echo chamber that undermines accurate self-assessment.
  3. The over-optimistic self-evaluations that result cause it to over-promise, under-deliver and stop prematurely.
  4. Its euphoric "I've been at the happy pills" language thus causes self-defeat: a significant negative to development value.

This cumulative reality distortion might be termed "Panglossian", "auto-propaganda" or "self-delusion".

Moderating its tone and eliminating emojis is therefore a serious requirement ... nobody wants a tool that counteracts itself.

cm2d · 11 months ago

Yeah, it’s really frustrating to see it mess up on this… and it eats up tokens for nothing… thanks, planet Earth.

mottysisam · 9 months ago

emojis and also icons, it's a nightmare with this. when I ask for a clean report with no emojis, and no icons, just strictly pure facts and data integrity i finally get a reasnable report. why shouldn't this be a default state?

github-actions[bot] · 8 months ago

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

KazuyaIna080 · 8 months ago

Workaround: PreToolUse Hook with updatedInput (requires v2.0.10+)

Until an official option is added, here's a working solution using the updatedInput feature introduced in v2.0.10.

This hook intercepts Write/Edit operations and auto-converts emoji/symbols to ASCII equivalents before the file is written.

Setup

  1. Create .claude/hooks/unicode_auto_fixer.js:
  1. Add to .claude/settings.local.json:
{
  "hooks": {
    "PreToolUse": [{
      "matcher": "Write|Edit",
      "hooks": [{
        "type": "command",
        "command": "node .claude/hooks/unicode_auto_fixer.js",
        "timeout": 5000
      }]
    }]
  }
}

How it works

  • Detects emoji, symbols, full-width characters in code output
  • Auto-replaces with ASCII equivalents (e.g., checkmark -> [OK], star -> *)
  • Uses updatedInput to modify content before write (not just block)
  • Preserves legitimate non-ASCII text (e.g., Japanese strings in user-facing code)

Example

Input:  "status: (checkmark-symbol) complete"
Output: "status: [OK] complete"

Tested Environment

  • Windows 11 + Japanese locale (cp932)
  • Claude Code v2.0.65
  • Node.js v20.x

Should also work for other non-UTF-8 Windows locales (cp1252, GB2312, etc.).

jaffster595 · 8 months ago

Thanks for the solution. Is there anyway to achieve this via the frontend GUI rather than when using the API?

Adrien2112 · 7 months ago

Is it the only issue on emojis ? Is there fix to be planned ? What is the latest workaround ?

github-actions[bot] · 6 months ago

Closing for now — inactive for too long. Please open a new issue if this is still relevant.

github-actions[bot] · 5 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.