CharsetEncoder for UTF-16 canEncode('\ufffe') is a bug?

H

Harald Kirsch

Hi,

in SUN's bug database I see that canEncode has quite
a few entries recently. By chance I stumbled myself
over this one just now

Charset.forName("UTF-16").newEncoder().canEncode('\ufffe');

returns true. The unicode spec says that FFFE is not
a character, so I would have expected this to be false.

Any ideas?

Harald.
 
R

Roedy Green

returns true. The unicode spec says that FFFE is not
a character, so I would have expected this to be false.

If you disagree with its definition of encodable, you can put a
wrapper around it to deal with your exception.

At least you can fix it. canDisplay is irretrievably broken by
returning true for any no space blob it puts up.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top