[rfc][icedtea-web] Replace single quote with two single quotes when using MessageFormat in Translator
Jie Kang
jkang at redhat.com
Mon Mar 16 18:20:06 UTC 2015
----- Original Message -----
> On 03/16/2015 05:32 PM CET Jie Kang wrote:
> > ----- Original Message -----
> >> Hello,
> >>
> >> When looking into reproducer failures I noticed that the single quote '
> >> was
> >> not being displayed in the logs.
> >>
> >> E.g:
> >>
> >> don't --> dont
> >>
> >> This was caused by the use of MessageFormat in the Translator class.
> >>
> >> From [1]: Within a String, "''" represents a single quote. [...]
> >>
> >> [1] http://docs.oracle.com/javase/6/docs/api/java/text/MessageFormat.html
> >>
> >> Out of the various possible fixes, I have decided to replace single quote
> >> instances with two quotes only prior to using the MessageFormat class.
> >> Afaict, this doesn't cause any issues and doesn't affect things that don't
> >> go through the MessageFormat class.
> >>
> >> This bug caused a number of reproducers to fail (ex.
> >> CodeBaseManifestEntryUnsignedNotMatching.BrowserJNLPHrefRemoteTest) as
> >> they
> >> expected a string like "don't" but the log output contained a string
> >> "dont".
> >> With this fix, those reproducers now pass.
> >>
> >> Thoughts?
>
> Hmm, the solution to this problem actually depends on the coding style of
> message property files. For example, OpenJDK works around this issue is by
> actually putting double apostrophe characters into their tool's message
> property
> files. So, IcedTea-Web should have or decide on some sort of coding style for
> its message property files. Which one should it be is arguable. Your approach
> is
> certainly valid, however whether it also acceptable depends on the coding
> style
> for message property files in IcedTea-Web. Personally, I would prefer
> OpenJDK's
> approach, hence modify the property files and do not get into possibly error
> prone mangling of strings.
I prefer users of the property files not having to deal with how the code formats the strings. I don't care which method goes in as long as one goes in so I'll wait for a third opinion.
>
> Btw, the proper term for ' (U+0027) is APOSTROPHE. There does not exist such
> a
> thing as a "single quote".
Sure apostrophe is more apt here.
'This sentence is surrounded by single quotation marks (quotes).'
Regards,
>
> Regards,
>
> Jacob
>
--
Jie Kang
OpenJDK Team - Software Engineering Intern
More information about the distro-pkg-dev
mailing list