How to escape special chars in resource bundles

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0

Normal Java resource bundles

Note
titleAPI: java.util.Properties

The method does not treat a backslash character, \, before a non-valid escape character as an error; the backslash is silently dropped. For example, in a Java string the sequence "\z" would cause a compile time error. In contrast, this method silently drops the backslash. Therefore, this method treats the two character sequence "\b" as equivalent to the single character 'b'.

MessageFormat rules

The table describes how to escape some special charaters.

The special chars \', { and }:

No Format
escape ' with another '
No Format
''

(double-single quote)

No Format
escape \ with another \
No Format
\\

(double backslash)

No Format
enclose } with '
No Format
'}'
No Format
enclose { with '
No Format
'{'