> 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/ja/narejjibsu/151-what-file-encodings-and-line-endings-should-i-use.md).

# どのファイルエンコーディングと改行コードを使うべきですか？

## エンコーディング

Overleaf は次のものを使用しています [UTF-8](https://en.wikipedia.org/wiki/UTF-8) すべてのテキストファイルに対して文字エンコーディングを使用しています。UTF-8 は現在、ウェブで最も広く使われている文字エンコーディングです。これを使えば、ユニコード文字を任意に表現できます。そこには、ギリシャ文字やアクセント付き文字を含む、非常に多様な文字、数字、記号が含まれます。

UTF-8 は、LaTeX ファイルやテンプレートでよく見られる latin1、latin9 などの多くの古いエンコーディングに取って代わります。TeX と LaTeX は UTF-8 より数十年早く登場しているため、LaTeX の UTF-8 サポートはやや一貫性がなく、どの [TeXエンジン](/latex/ja/xiang-xi-ji-shi/55-what-s-in-a-name-a-guide-to-the-many-flavours-of-tex.md) 使用しているものに依存します。

### LaTeX と pdfLaTeX でのサポート

pdfLaTeX（つまり、pdfTeX エンジンを使って LaTeX を実行する）を使用している場合、これは Overleaf の既定です。文書のプリアンブルに次の \usepackage コマンドを含めれば、ほとんどのアクセント付き文字と一部の記号を直接組版できます:

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

これはプリアンブル内で唯一の inputenc 行であるべきなので、他のエンコーディングを使うものはこれに置き換えるべきです。

ただし、TeX はすべての UTF-8 文字を組版する方法を知っているわけではありません。お使いの文字の組版方法を知らない場合、次のようなエラーが出ることがあります:

```latex
パッケージ inputenc エラー: Unicode 文字 \u8:��� は LaTeX で使用するよう設定されていません。
```

XeLaTeX や LuaLaTeX のようなより新しい TeX エンジンなら、そのような Unicode 文字をネイティブにサポートできます。

### XeLaTeX または LuaLaTeX でのサポート

これらのより新しい LaTeX エンジンのいずれかを使用している場合、UTF-8 をより直接的に多く使えます。次のことができます [Overleaf でエンジンを選択する](/latex/ja/sononotopikku/08-choosing-a-latex-compiler.md) プロジェクトのファイル一覧パネルの上にある Overleaf のメニューアイコンをクリックして。

### 無効/未サポートの文字

技術的な理由により、Overleaf は次を含むファイルを保存できません [NUL 文字](https://en.wikipedia.org/wiki/Null_character) または、Unicode の外側の文字を含むファイルを保存できません [基本多言語面](https://en.wikipedia.org/wiki/Plane_\(Unicode\))（BMP）。BMP には最初の 65,536 個の Unicode コードポイントしか含まれていません。Unicode の数学記号や東洋言語の一部の記号の中には BMP の外側にあるものがあります。BMP 外の数学記号は、PDF からウェブページへコピーする際に現れることがあります。

最善の回避策は、BMP 外の文字を同等の LaTeX コマンドに置き換えることです。たとえば、入力したり貼り付けたりする代わりに [𝛼 (U+1D6FC 数学イタリック小文字アルファ)](https://www.fileformat.info/info/unicode/char/1d6fc/index.htm)の代わりに次のように書きます `$\alpha$`. [Detexify](http://detexify.kirelabs.org/classify.html) は、ある記号に対応する LaTeX コマンドを見つけるのに便利なツールです。

絵文字については、次のものを使えます `\symbol` コマンドを、次と組み合わせて `fontspec`、XeLaTeX、および適切なフォント。たとえば:

```latex
落ち葉: {\fontspec{Symbola}\symbol{"1F343}}
```

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

色付き絵文字を使いたい場合は、次を確認するとよいでしょう [絵文字](http://texdoc.net/pkg/emoji) パッケージ。必要になるのは [プロジェクトのコンパイラを変更することです](/latex/ja/narejjibsu/026-changing-compiler.md) LuaLaTeX にします。すると次を読み込めます `絵文字` パッケージを読み込み、次のように書けます `\emoji{leaves}`.

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

LaTeX で絵文字を使用する方法についての詳細は、次の記事にあります [Overleaf の LaTeX 文書に絵文字を挿入する](/latex/ja/to-2/75-inserting-emojis-in-latex-documents-on-overleaf.md).

## 改行コード

Overleaf は、Microsoft Windows 形式の改行コード \r\n（CRLF）ではなく、Unix 形式の改行コード \n（LF）を使用します。

もし次を使用しているなら [git インターフェース](https://www.overleaf.com/blog/195) Overleaf 上でプロジェクトを編集するには、システムのローカルな改行コードを使い、次の方法で git に Unix 改行へ変換させることができます [git の autocrlf 設定を有効にする](https://help.github.com/articles/dealing-with-line-endings).

次にも興味があるかもしれません [この記事](/latex/ja/xiang-xi-ji-shi/05-an-introduction-to-endlinechar-how-tex-reads-lines-from-text-files.md) TeX プロセッサが改行コードをどのように扱うかについて。

## 関連ヘルプ記事

* [アクセント付き文字（例: フランス語やポルトガル語）を使うにはどうすればよいですか?](/latex/ja/to-2/37-how-do-i-use-letters-with-accents-e.g.-in-french-or-portuguese.md)
* [polyglossia と fontspec を使用した Overleaf での多言語組版](/latex/ja/yan-yu/01-multilingual-typesetting-on-overleaf-using-polyglossia-and-fontspec.md)
* [\endlinechar の入門：TeX がテキストファイルから行を読む仕組み](/latex/ja/xiang-xi-ji-shi/05-an-introduction-to-endlinechar-how-tex-reads-lines-from-text-files.md)
* [Overleaf の LaTeX 文書に絵文字を挿入する](/latex/ja/to-2/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/ja/narejjibsu/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.
