LESSON 09 OF 52 · CHAPTER 01

Unicode

UTF-8 literals

ORIGINAL SOURCE

09-unicode.srp

// UTF-8 text is preserved.
print("नमस्ते 🌍");
print("café — Scarp");
EXPECTED OUTPUT

stdout

Verified
नमस्ते 🌍
café — Scarp

UNDERSTAND THE CODE

Explanation & practice

What this example teaches

UTF-8 literals

Expected behavior

नमस्ते 🌍 and café — Scarp

Practice: Read the source before looking at the output. Predict the values and their order, then use the pinned compiler to execute this lesson and compare the exact fixture. Identify which operation produces the result.

यूनिकोड टेक्स्ट

Scarp की स्ट्रिंग में हिन्दी, उच्चारण चिह्न और इमोजी सुरक्षित रखे जा सकते हैं। स्रोत UTF-8 में सहेजें।

अभ्यास: दोनों print कथनों का आउटपुट मिलाएँ।

Explanations are sourced from the project's English chapter guide and हिन्दी अध्याय. The Scarp program and output are unchanged.

TRY IT LOCALLY

Verify, then execute

Use the pinned compiler from the course root. Keep any imported _support files next to the source.

scarp verify examples/01-basics/09-unicode.srp scarp exec examples/01-basics/09-unicode.srp

The website does not run code. Read the CLI guide ↗

Pinned compiler: Scarp v0.0.6-alpha.3 · ceff07d9014f. No simulated output.