Sometimes, We want to include special characters in value of properties file.

Let’s see some examples

# include special characters

selectquery= select * from table where id=10

We can include below special characters to escape and read by java programmer

  • # symbol
  • = symbol
  • : symbol

escape # sign in properties file

# character can be escaped with \ symbol in properties file

# include special characters

name= first \\# last

How to escape equal sign in properties file

Here is an example

# include special characters

selectquery= select * from table where id`\=`10

The same can be escaped with java unicode characters equal sign can be replaced with java unicode \u003d value and white space for \u0020

# include special characters


escape @ character in properties file

some times, We want to escape @ character in properties file. For example, email value\\

encoded character we can use %40 in place of @

escape backslash in properties files

For example, storing the path contain backslashes, use double backslashes


Replace with backslash with \u005c using encoding character


When you use escaped characters, In java processor you have to read the processor content with encoding


You learned many ways to use escape and special characters in properties.

You can use different ways or unicode characters. Unicode characters are less readable