page Encoding

Discussion in 'Java' started by gk, Jan 20, 2006.

  1. gk

    gk Guest

    code:

    i see a JSP which has

    <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>


    when do i use "pageEncoding="UTF-8" ?

    ......and when do i skip it ?

    is it a optional parameter ?
     
    gk, Jan 20, 2006
    #1
    1. Advertising

  2. gk wrote:
    > code:
    >
    > i see a JSP which has
    >
    > <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
    >
    >
    > when do i use "pageEncoding="UTF-8" ?
    >
    > .....and when do i skip it ?
    >
    > is it a optional parameter ?
    >


    It is optional. Use it to specify what encoding is used when converting
    characters to bytes when sending the response to the browser. In most
    cases you do not care about this, but the times when you do, you really
    care. :)

    Seriously, if you are sticking with ASCII characters you should be fine.
    Issues arise when you start using international (from the U.S.
    viewpoint) characters.

    HTH,
    Ray

    --
    This signature intentionally left blank.
     
    Raymond DeCampo, Jan 24, 2006
    #2
    1. Advertising

  3. gk

    Oliver Wong Guest

    "Raymond DeCampo" <> wrote in message
    news:aRuBf.114692$...
    > gk wrote:
    >> code:
    >>
    >> i see a JSP which has
    >>
    >> <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
    >>
    >>
    >> when do i use "pageEncoding="UTF-8" ?
    >>
    >> .....and when do i skip it ?
    >>
    >> is it a optional parameter ?
    >>

    >
    > It is optional. Use it to specify what encoding is used when converting
    > characters to bytes when sending the response to the browser. In most
    > cases you do not care about this, but the times when you do, you really
    > care. :)
    >
    > Seriously, if you are sticking with ASCII characters you should be fine.
    > Issues arise when you start using international (from the U.S. viewpoint)
    > characters.


    If you know you are using the US ASCII encoding, you should probably
    specify so (pageEncoding="us-ascii"). There exists encodings for which the
    glyph a certain character code maps to is different from the glyph in
    US-ASCII.

    If you have no idea what encoding you're using, I recommend omitting the
    attribute altogether, so as to allow the user's browser try to automatically
    guess the encoding (or let the user manually set the encoding).

    - Oliver
     
    Oliver Wong, Jan 24, 2006
    #3
    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. =?Utf-8?B?V0VJV0VJV0VJ?=

    encoding problem on ASP .net page

    =?Utf-8?B?V0VJV0VJV0VJ?=, Apr 16, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    697
    Joerg Jooss
    Apr 16, 2004
  2. Hardy Wang

    Encoding.Default and Encoding.UTF8

    Hardy Wang, Jun 8, 2004, in forum: ASP .Net
    Replies:
    5
    Views:
    18,886
    Jon Skeet [C# MVP]
    Jun 9, 2004
  3. z f

    aspx page encoding

    z f, Dec 26, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    7,357
  4. Replies:
    1
    Views:
    23,383
    Real Gagnon
    Oct 8, 2004
  5. Replies:
    2
    Views:
    378
Loading...

Share This Page