Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

When reading with a Reader from an ASCII source, how does the Reader know it is ASCII/8-bit instead of Unicode/16-bit data?

0
Posted

When reading with a Reader from an ASCII source, how does the Reader know it is ASCII/8-bit instead of Unicode/16-bit data?

0

Location: http://www.jguru.com/faq/view.jsp?EID=88802 Created: Jun 27, 2000 Modified: 2001-08-18 17:34:57.381 Author: Sandip Chitale (http://www.jguru.com/guru/viewbio.jsp?EID=14537) Question originally posed by ori soen (http://www.jguru.com/guru/viewbio.jsp?EID=81264 Well the Reader really wraps an InputStream which gives byte-level access to the data source. What the Reader (e.g. InputStreamReader) does is to load a correct implementation of sun.io.ByteToCharConverter based on the “file.encoding” System property. This property is initialized by the JVM by default after consulting the native operating system settings. You can override that by setting the “file.encoding” property using the -Dfile.encoding=whatever This affects all instances of the InputStreamReader though. The InputStreamReader has a constructor which you can use to pass the encoding on a per instance basis. Here is the link to supported encodings: http://java.sun.com/products/jdk/1.2/docs/guide/internat/encoding.doc.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.