> For the complete documentation index, see [llms.txt](https://overleaf-pro.ayaka.space/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://overleaf-pro.ayaka.space/latex/knowledge-base/151-what-file-encodings-and-line-endings-should-i-use.md).

# What file encodings and line endings should I use?

## Encoding

Overleaf uses the [UTF-8](https://en.wikipedia.org/wiki/UTF-8) encoding for all text files. UTF-8 is the most widely used character encoding on the web today. You can use it to represent any unicode character, which includes an enormous variety of letters, numbers and symbols, including Greek letters and letters with accents.

UTF-8 supersedes many older encodings, such as latin1, latin9, which are often found in LaTeX files and templates. TeX and LaTeX predate UTF-8 by several decades, so LaTeX support for UTF-8 is somewhat inconsistent and depends on which [TeX engine](/latex/in-depth-articles/55-what-s-in-a-name-a-guide-to-the-many-flavours-of-tex.md) you are using.

### Support with LaTeX and pdfLaTeX

If you are using pdfLaTeX (i.e., running LaTeX using the pdfTeX engine), which is the default on Overleaf, you can typeset most accented letters and some symbols directly if you include this \usepackage command in the preamble of your document:

```latex
\usepackage[utf8]{inputenc}
```

This should be the only inputenc line in your preamble, so it should replace any that use other encodings.

However, TeX does not know how to typeset all UTF-8 characters. You may get an error like this, if it does not know how to typeset your character:

```latex
Package inputenc Error: Unicode char \u8:��� not set up for use with LaTeX.
```

A more modern TeX engine, such as XeLaTeX or LuaLaTeX, can support such unicode characters natively.

### Support with XeLaTeX or LuaLaTeX

If you are using one of these more modern LaTeX engines, you can use much more of UTF-8 directly. You can [choose the engine on Overleaf](/latex/more-topics/08-choosing-a-latex-compiler.md) by clicking on Overleaf menu icon above your project's file list panel.

### Invalid/Unsupported Characters

For technical reasons, Overleaf cannot store files that contain [NUL characters](https://en.wikipedia.org/wiki/Null_character) or files that contain characters from outside of Unicode's [Basic Multilingual Plane](https://en.wikipedia.org/wiki/Plane_\(Unicode\))(BMP). The BMP contains only the first 65,536 unicode code points. Some unicode mathematical symbols and some symbols from eastern languages are outside of the BMP. Non-BMP mathematical symbols sometimes arise when copying from PDFs for web pages.

The best workaround is to replace the non-BMP characters with equivalent LaTeX commands, e.g. instead of typing or pasting [𝛼 (U+1D6FC MATHEMATICAL ITALIC SMALL ALPHA)](https://www.fileformat.info/info/unicode/char/1d6fc/index.htm), write instead `$\alpha$`. [Detexify](http://detexify.kirelabs.org/classify.html) is a useful tool for finding the LaTeX command that corresponds to a given symbol.

For emojis, you can use the `\symbol` command in tandem with `fontspec`, XeLaTeX, and a suitable font. For example:

```latex
Falling leaves: {\fontspec{Symbola}\symbol{"1F343}}
```

![Emoji-symbola-falling-leaves.png](/files/ZzXqyLfdpTFQuqWLUeXU)

If you want to use colour emojis, you may want to have a look at the [emoji](http://texdoc.net/pkg/emoji) package. You will need to [change your project's compiler](/latex/knowledge-base/026-changing-compiler.md) to be LuaLaTeX. You can then load the `emoji` package, and write `\emoji{leaves}`.

![Colour-emojis.png](/files/d0AxbNXgdhOsP4GNSiWy)

Further information on using emoji with LaTeX can be found in the article [Inserting emojis in LaTeX documents on Overleaf](/latex/questions-and-answers/75-inserting-emojis-in-latex-documents-on-overleaf.md).

## Line Endings

Overleaf uses unix-style newline endings, \n (LF), rather than Microsoft Windows-style line endings \r\n (CRLF).

If you are using the [git interface](https://www.overleaf.com/blog/195) to edit your projects on Overleaf, then you can use your system's local line endings and have git translate them to unix line endings for you by [enabling git's autocrlf setting](https://help.github.com/articles/dealing-with-line-endings).

You may also be interested in [this article](/latex/in-depth-articles/05-an-introduction-to-endlinechar-how-tex-reads-lines-from-text-files.md) about how line endings are handled by the TeX processor.

## Related Help Articles

* [How do I use letters with accents (e.g. in French or Portuguese)?](/latex/questions-and-answers/37-how-do-i-use-letters-with-accents-e.g.-in-french-or-portuguese.md)
* [Multilingual\_typesetting\_on\_Overleaf\_using\_polyglossia\_and\_fontspec](/latex/languages/01-multilingual-typesetting-on-overleaf-using-polyglossia-and-fontspec.md)
* [An introduction to \endlinechar: How TeX reads lines from text files](/latex/in-depth-articles/05-an-introduction-to-endlinechar-how-tex-reads-lines-from-text-files.md)
* [Inserting emojis in LaTeX documents on Overleaf](/latex/questions-and-answers/75-inserting-emojis-in-latex-documents-on-overleaf.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://overleaf-pro.ayaka.space/latex/knowledge-base/151-what-file-encodings-and-line-endings-should-i-use.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
