Solidity REPL
Encoding & crypto

String, Unicode, and hex literals

Build UTF-8 strings and raw bytes with Solidity literal syntax.

Solidity 0.8.36REPL mode

Why use this example

Use this pattern when you need to check the exact bytes, selector, hash, or decoded values that Solidity will produce. The entry isolates string, unicode, and hex literals so its input, result, and state changes stay easy to compare.

Solidity to run

string memory greeting = unicode"Hello, 世界"
bytes memory magic = hex"deadbeef"
string memory joined = string.concat(greeting, "!")
bytes memory joinedBytes = bytes.concat(magic, hex"cafe")

greeting
joined
joinedBytes

Official Solidity reference

Compare this focused investigation with the complete language definition in the Solidity documentation.

String and hex literals

What to expect

The transcript preserves the Unicode greeting and displays the concatenated text and raw hexadecimal bytes.

Continue the investigation

Change a value, add another expression, or open Inspect after the run. Accepted entries remain available to the next entry, and the clean replay keeps the complete result reproducible.

Read about values and inspection Prototype Solidity behavior