Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Saving Arabic Text

Reply
Thread Tools

Saving Arabic Text

 
 
Khan
Guest
Posts: n/a
 
      04-30-2006
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.

 
Reply With Quote
 
 
 
 
John C. Bollinger
Guest
Posts: n/a
 
      05-02-2006
Khan wrote:
> 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().


--
John Bollinger

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Writing Arabic text to a PDF file Swetha Java 10 10-11-2007 12:39 PM
Arabic text displayed as question marks Swetha Java 16 12-13-2005 10:36 PM
when i try to insert or update text in arabic it appears "????" mansour via DotNetMonster.com ASP .Net 1 09-11-2005 12:42 PM
Displaying Arabic text in XML suhaddad@gmail.com XML 3 03-01-2005 04:08 PM
Arabic Text Rendering Alex Nazarian Java 9 10-28-2004 01:07 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57