Default Charset Encoding in JSP page is ASCII

F

Fritz Bayer

Hello,

I'm opening a file from my JSP file. If I do not set the encoding to
ISO-8859-1 the file is read in as ascii.

I checked the encoding with:

InputStreamReader fileReader = new InputStreamReader(new
FileInputStream("test.txt"));
tmp = fileReader.getEncoding();

and it clearly says ASCII.

How come that the default encoding of the FileInputStream is set to
ASCII? Shouldn't it be set to the default fileset encoding which is
ISO-8859-1 on my linux box (my System.property of file.encoding is
ISO-8859-15)?

Or is this set somewhere else in the appserver? I'm using jboss 4.0.0
with tomcat 5.0.x integrated.

Fritz
 
W

Wibble

Fritz said:
Hello,

I'm opening a file from my JSP file. If I do not set the encoding to
ISO-8859-1 the file is read in as ascii.

I checked the encoding with:

InputStreamReader fileReader = new InputStreamReader(new
FileInputStream("test.txt"));
tmp = fileReader.getEncoding();

and it clearly says ASCII.

How come that the default encoding of the FileInputStream is set to
ASCII? Shouldn't it be set to the default fileset encoding which is
ISO-8859-1 on my linux box (my System.property of file.encoding is
ISO-8859-15)?

Or is this set somewhere else in the appserver? I'm using jboss 4.0.0
with tomcat 5.0.x integrated.

Fritz

I just had this bug too. I'm pretty sure it used to be 8859-1 too in
1.2.2. The spec says its machine dependent, so dont rely on defaults.
 

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top