Fixing encoding problem with string format.

Related to issue #1511