Default Charset Encoding in JSP page is ASCII

Discussion in 'Java' started by Fritz Bayer, May 30, 2005.

  1. Fritz Bayer

    Fritz Bayer Guest

    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
     
    Fritz Bayer, May 30, 2005
    #1
    1. Advertising

  2. Fritz Bayer

    Wibble Guest

    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.
     
    Wibble, May 30, 2005
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Guoqi Zheng

    ascii or not, the charset of a string

    Guoqi Zheng, Sep 4, 2004, in forum: ASP .Net
    Replies:
    5
    Views:
    1,846
  2. J.P.Jarolim
    Replies:
    0
    Views:
    1,055
    J.P.Jarolim
    Feb 27, 2004
  3. cs_professional
    Replies:
    14
    Views:
    5,274
    cs_professional
    Dec 12, 2010
  4. optimistx

    javascript charset <> page charset

    optimistx, Aug 14, 2008, in forum: Javascript
    Replies:
    2
    Views:
    279
    optimistx
    Aug 15, 2008
  5. Helmut Jarausch

    email with a non-ascii charset in Python3 ?

    Helmut Jarausch, Aug 15, 2012, in forum: Python
    Replies:
    3
    Views:
    180
    Steven D'Aprano
    Aug 16, 2012
Loading...

Share This Page