<i18n dev> java.util.Fomatter precision and surrogate pairs
naoto.sato at oracle.com
Sun Feb 14 18:00:02 UTC 2021
On 2/13/21 4:09 PM, Jason Mehrens wrote:
> Hi Naoto,
> Sorry for the off thread reply. I didn't have the mail replies setup on the list and I seem to be unable to add a in-reply-to header via web email.
>> Although the error message may be confusing, 'c' conversion cannot be
>> used for a String argument (like in your example). It simply converts
>> numeric value into a single character, thus no need for output
>> "precision." I am not the designer of the class, so might be wrong.
> Yes I totally missed that. I dug up the relevant source:
> So this code doesn't deal with CharSequence and therefore the precision is implicitly one. With the exception if null getting converted to 4 chars.
> Is it worth me filing an RFE to allow 'c' to accept a CharSequence and allow precision to be set?
Again, 'c' is for a single character, so I don't think taking
CharSequence as an argument is the right choice. Rather, I would fix the
current spec/behavior of 's', which bisects a supplementary character at
the end. To me, it is just supplementary characters are not handled
correctly in 's' conversion.
More information about the i18n-dev