7

While working on a French app (french language is full of single quotes), I needed to use i18n with single quotes and many other accentuated chars.

So here is an extract of my messages.fr-FR file :

some.key=C'est la vie!

And here is the output :

Cest la vie!

How can I use strings containing single quotes in my messages? Already tried those :

some.key=C\'est la vie! --> C\est la vie!
some.key="C'est la vie!" --> "Cest la vie!"

EDIT : Thanks to the link KDavid gave I was able to find the solution. You have to double single-quote.

C''est la vie! --> C'est la vie!
Community
  • 1
  • 1
i.am.michiel
  • 10,281
  • 7
  • 50
  • 86
  • 1
    According to [an hold post][1] [1]: http://stackoverflow.com/questions/495776/should-i-use-java-text-messageformat-for-localised-messages-without-placeholders you should use \u2019s for single quote. – Valerio Emanuele Aug 22 '12 at 09:32
  • None of these worked. `"` was esacaped as `"` and `\u2019` is displayed as is. But I found another solution in the post, you linked : double quoting. If you answer the question, I'll accept yours ;) – i.am.michiel Aug 22 '12 at 10:13
  • Ooops. looks like I 'stolen' accept promise from @KDavid - excuse me ;) of course if you'll switch it to him I won't mind :) – biesior Aug 22 '12 at 22:29

1 Answers1

13

prefix the single quote with... single quote (so just use two single quotes):

some.key=C''est la vie!
biesior
  • 55,576
  • 10
  • 125
  • 182