# Quoting and Escaping

Different translation formats handle quoting and escaping strings differently. This is meant to be a common page which outlines the differences

## PO format

Strings are quoted using double quotes. For long strings multiline quotes are done by opening and closing the quotes on each line. Usually in this case the first line is left blank. The splitting of strings over lines is transparent i.e. it does not imply line breaks in the translated strings.

Escaping is done with a backslash. An escaped double quote (`\"`) corresponds to a double quote in the original string. `\n` for newline, `\t` for tabs etc are used. Backslashes can be escaped to give a native backslash.

See also escaping in the translation guide.

Example:

    msgid ""
    "This is a long string with a \n newline, a \" double quote, and a \\ backslash."
    "There is no space between the . at the end of the last sentence "
    "and the T at the beginning of this one."

## DTD format

Strings are quoted using either double or single quotes. The quoting character may not occur within the string. There is no provision for escaping. XML entities can be used e.g. `&apos;` can be used to denote a single quote within the single-quoted string.

Some DTD files seem to have backslash-escapes, but these are anomalies: see discussion thread on Mozilla l10n-dev

## Mozilla properties format

Note that this section does not describe the Java properties files, even though they are quite similar.

It seems that the literal string `\n` (a backslash followed by the character ‘n’) and `\t` and `\r` cannot be encoded in properties files. This is the assumption of the toolkit.