Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / May 2006

Tip: Looking for answers? Try searching our database.

Saving Arabic Text

Thread view: 
Khan - 30 Apr 2006 13:11 GMT
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.
John C. Bollinger - 02 May 2006 06:24 GMT
> I'm trying to save arabic text through sql query. I'm selecting text
> from a combo box and using the code "String test =
[quoted text clipped - 5 lines]
>
> 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().

Signature

John Bollinger
jobollin@indiana.edu



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.