Skip to content

Default user text to UTF-8#2646

Open
C85297 wants to merge 1 commit into
gchq:masterfrom
C85297:default-input-text-to-utf8
Open

Default user text to UTF-8#2646
C85297 wants to merge 1 commit into
gchq:masterfrom
C85297:default-input-text-to-utf8

Conversation

@C85297

@C85297 C85297 commented Jul 6, 2026

Copy link
Copy Markdown
Member

Description
When users enter text into CyberChef, it should probably be assumed they are typing UTF-8 text.

Instead, if the user has the default "Raw Bytes" selected, CyberChef interprets the text ambiguously - if the first operation takes ArrayBuffer input and the input contains only code units up to 0xFF, each code unit is used as a single byte. For example, á becomes e1, so direct MD5 hashes byte e1. But, if the input contains at least one code unit above 0xFF, the entire input is encoded as UTF-8. For example, اá becomes d8 a7 c3 a1, so the same á character is represented as UTF-8 bytes c3 a1 only because another character in the same input forced UTF-8 conversion. This makes byte-oriented results depend not only on a character itself, but also on whether any other character in the same input falls outside the single-byte range. The same á character is represented differently in á versus اá or わá.

This PR updates CyberChef to default user input to UTF-8. File uploads remain raw bytes.

To retain behaviour in existing CyberChef links, I kept links without a specified encoding following the old behaviour. New links for user entered text will specify UTF-8 encoding. I wasn't 100% sure which way to go on this so would appreciate any thoughts.

Existing Issue
Closes #322
Closes #1127

Screenshots
No

AI disclosure
gpt-5.5

Test Coverage
Yes

@C85297 C85297 self-assigned this Jul 6, 2026
@C85297 C85297 added the bug label Jul 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug report: URL Encoding outputs extra characters Misc: Input text encoding question

1 participant