Saving Arabic Text

K

Khan

Hi,

I'm trying to save arabic text through sql query. I'm selecting text
from a combo box and using the code "String test =
request.getParameter("hidden"); "

When i'm displaying a java message box the arabic text is displaying
like boxes but when i'm displaying message using 'alert' in jsp, arabic
is coming fine.

Problem seems to be in "request.getParameter("hidden") .

Plz advise some solution.

Thanx.
 
J

John C. Bollinger

Khan said:
I'm trying to save arabic text through sql query. I'm selecting text
from a combo box and using the code "String test =
request.getParameter("hidden"); "

When i'm displaying a java message box the arabic text is displaying
like boxes but when i'm displaying message using 'alert' in jsp, arabic
is coming fine.

Problem seems to be in "request.getParameter("hidden") .

I'm not very clear on either what you want to happen or on what is
actually happening. I'm particularly confused as to where an SQL query
fits in, as everything else you mention seems to pertain to a web API.
Do you perhaps mean an *HTTP* query? Most of my comments below assume
that you do, indeed, mean HTTP.

I might be able to offer better-targeted advice if I had more
information, but here are some general considerations:

() Your problem very likely results from a character encoding problem.
Both client and server must agree on the character encoding; otherwise
character data transferred between them will be garbled.

() When displaying the text, there is an entirely separate question of
whether the font in use contains glyphs for the characters you are
trying to display. The fact that the system may have such fonts
installed does not imply that they will be used to display your text.

() The default character encoding for HTTP is ISO-8859-1, which has no
code points for Arabic characters. If you are using standard browsers
and not doing anything special in your servlet or JSP then it is
possible that either the client, the server, or both are assuming this
encoding. Even if both agreed on ISO-8859-1, that would probably
*still* garble Arabic text.

() Some of the things you probably need to do involve configuring the
HTTP message carrying the HTML page in which the form is delivered, and
the adjusting details of the form itself: (1) The HTTP message should be
encoded with a charset that supports the characters you need; UTF-8 is a
good general-purpose choice. (2) The relevant FORM element should have
an accept-charset attribute that specifes (only) the charset you want
the client to use to encode the response. The charset specified in (2)
does not need to be the same as the one described in (1), though it's
probably easier if it is.

() The servlet / JSP might need to specify the charset to use to read
the query; see ServletRequest.setCharacterEncoding().
 

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,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top