page Encoding

G

gk

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 ?
 
R

Raymond DeCampo

gk said:
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
 
O

Oliver Wong

Raymond DeCampo said:
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
 

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

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,900
Latest member
Nell636132

Latest Threads

Top