Previous: Including LilyPond files, Up: Input files


10.1.4 Text encoding

LilyPond uses the Pango library to format multi-lingual texts, and does not perform any input-encoding conversions. This means that any text, be it title, lyric text, or musical instruction containing non-ASCII characters, must be utf-8. The easiest way to enter such text is by using a Unicode-aware editor and saving the file with utf-8 encoding. Most popular modern editors have utf-8 support, for example, vim, Emacs, jEdit, and GEdit do.

Depending on the fonts installed, the following fragment shows Hebrew and Cyrillic lyrics,

[image of music]

The TeX backend does not handle encoding specially at all. Strings in the input are put in the output as-is. Extents of text items in the TeX backend, are determined by reading a file created via the texstr backend,

lilypond -b texstr input/les-nereides.ly
latex les-nereides.texstr

The last command produces les-nereides.textmetrics, which is read when you execute

lilypond -b tex input/les-nereides.ly

Both les-nereides.texstr and les-nereides.tex need suitable LaTeX wrappers to load appropriate LaTeX packages for interpreting non-ASCII strings.

To use a Unicode escape sequence, use

#(ly:export (ly:wide-char->utf-8 #x2014))

See also

input/regression/utf-8.ly

This page is for LilyPond-2.8.8 (stable-branch).

Report errors to http://post.gmane.org/post.php?group=gmane.comp.gnu.lilypond.bugs.

Other languages: English.
Using automatic language selection.