Apache Struts 2 Documentation > Home > FAQs > How to escape special chars in resource bundles
Added by Rainer Hermanns, last edited by Ted Husted on Jul 22, 2006  (view change) show comment

Normal Java resource bundles

API: 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 }:

escape ' with another '
''
(double-single quote)
escape \ with another \
\\
(double backslash)
enclose } with '
'}'
enclose { with '
'{'