# 2.1 Source text and encoding

> A program is UTF-8 text; the engine reads it character by character and remembers the line and column of each one to point at errors precisely.

Web page: https://pseudolearn.app/en/spec/lexico/texto-fuente

> **In one sentence**
>
> A program is UTF-8 text; the engine reads it character by character and remembers the line and column of each one to point at errors precisely.

## 2.1.1 How it works

The **source text** is what you write. PseudoLearn reads it as **UTF-8** text, the encoding that lets you write ñ, accents and any other Unicode symbol inside texts and comments.

Every character has a **position**: its line and its column, counting from 1. When the engine finds a problem, it uses those positions to point at the exact place. Lines can be separated with any of the three usual operating-system conventions; the engine treats them the same.

**Figure 2.1-1: Lines, columns and spans**

A three-line program on a grid with line numbers on the left and column numbers above. On the second line the x of Write x is highlighted in red, and an arrow joins it to a note explaining that the span starts at line 2, column 12.

Every character has a line and a column. A diagnostic points at a span that starts at one position and ends just before another.

Texts keep exactly what you wrote, including characters outside the Latin alphabet:

### Program: Unicode inside a text

```pseudolearn
Algorithm Saludos
  Write "¡Hola! ¿Qué tal?";
  Write "Ñandú, pingüino, café";
EndAlgorithm
```

**Output**

```text
¡Hola! ¿Qué tal?
Ñandú, pingüino, café
```

*The program finishes normally.*

## 2.1.2 Normalisation

In Unicode, some accented letters can be written in two ways: as a single character or as a letter followed by an accent. To compare names, the engine first converts them to the same form, called **NFC**. That way `año` is always the same name, however you type it. Quoted texts are not touched.

> **Limit**
>
> A position counts lines and columns from 1 and characters from 0. A span includes its start and excludes its end. A text that is not valid UTF-8 is not analysed: it is reported as an input failure.

**In short**
- Source text is UTF-8.
- Every character has a line and a column from 1.
- Names are compared after normalising to NFC; texts are not modified.

**See also**
- [2.2 Spaces and line breaks](https://pseudolearn.app/en/spec/lexico/espacios.md)
- [2.4 Identifiers](https://pseudolearn.app/en/spec/lexico/identificadores.md)
