Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Default Charset Encoding in JSP page is ASCII

Reply
Thread Tools

Default Charset Encoding in JSP page is ASCII

 
 
Fritz Bayer
Guest
Posts: n/a
 
      05-30-2005
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
 
Reply With Quote
 
 
 
 
Wibble
Guest
Posts: n/a
 
      05-30-2005
Fritz Bayer wrote:
> 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.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
email with a non-ascii charset in Python3 ? Helmut Jarausch Python 3 08-15-2012 11:54 PM
String default encoding: UTF-16 or Platform's default charset? cs_professional Java 14 12-12-2010 06:10 PM
javascript charset <> page charset optimistx Javascript 2 08-15-2008 12:42 PM
ascii or not, the charset of a string Guoqi Zheng ASP .Net 5 09-05-2004 10:17 PM
Problem with default Charset Encoding Servlet (Windows vs. RedHat) J.P.Jarolim Java 0 02-27-2004 04:11 PM



Advertisments