File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Other Java Products and Servers and the fly likes Displaying Arabic characters on iWS 6 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Other Java Products and Servers
Bookmark "Displaying Arabic characters on iWS 6" Watch "Displaying Arabic characters on iWS 6" New topic

Displaying Arabic characters on iWS 6

Kareem Gad
Ranch Hand

Joined: Aug 06, 2001
Posts: 89
I'm sure this problem is trivial but i've searched all over the forums on the iPlanet support sites and couldn't get something solid.
I am running my JSP's on iWS 6 and all is fine until the page contains characters of a certain encoding ( mainly the windows-1256 )
i tried ofcourse setting the encoding on the HTML meta tag like this :

only works for static HTML pages but when the file is .jsp ( ie gets parsed by the JSP compiler ) doesn't work.
so i tried setting it using the JSP tag :

now something happens .. instead of getting the funny looking characters i get question marks '?'
i even set encoding variables in the magnus.con file etc .. still no solution.
i hope someone can help in this.
Thanks in advance.

<b><i>KaReEm</i><br /><ul type="square"><li>SCJP-Free Range Web Developer <br /></ul></b>
Suresh Selvaraj
Ranch Hand

Joined: Nov 14, 2000
Posts: 104
Try the following......
1.In the JSP scriplet i.e in contentType......
2.You should have the arabic equivalent of "" file for all the name-value pairs.
File Name :
SUNONE="....hex code equivalent of the word SUNONE..".
Also, you need to use ResourceBundle.
ResourceBundle rb=ResourceBundle.getBundle("fileName",Locale);
In jsp, to print the Arabic version of SUNONE, you should call,
<%= rb.getString("SUNONE") %>
Refer sun documentation on creating a Locale for Arabic.
Selvaraj Suresh

Suresh Selvaraj, (author of JQuiz)<br />SCJP2<br /><a href="" target="_blank" rel="nofollow"></a>
Kareem Gad
Ranch Hand

Joined: Aug 06, 2001
Posts: 89
Thanx Suresh for your reply.
1. putting cp1256 in my jsp scriptlet just messes up the page ( gives a Server error and the JSP isn't compiled )
2. I don't think my problem requires going through the hassle of locales, I mean it's as simple as adding the HTML header in the jsp page.
See .html files show the arabic ok when i have this header

that's because it is not handled by the JSP comipler of the webserver.
on the other hand .jsp files are not showing the arabic characters correctly ( even if it was the same .html file but just renamed the extension )
when the page shows on the browser the encoding selected is Western European (ISO). Which means it totally ignored the arabic headers i'm giving it on the HTML level, in the JSP level .. and even on the webserver level ( when i editted the magnus.conf file )
can't seem to find any support on this matter anywhere .. do you have any support sites other than the one provided by sun?
Hope someone can help!
Suresh Selvaraj
Ranch Hand

Joined: Nov 14, 2000
Posts: 104
You may want to try this.
1.In Windows 2000, start -->settings -->Control Panel-->Regional Options--> check(tick) Arabic option.
2.In "Set Default", select Arabic (Saudi Arabia).
3.In your system environment path settings, include the following name-value pairs.
NLS_LANG ---> Arabic_Saudi Arabia.UTF8
I am sure, now you should be able to see the Arabic characters.
Selvaraj Suresh
Kareem Gad
Ranch Hand

Joined: Aug 06, 2001
Posts: 89
Ok Suresh .. there seems to be some advancement with what you told me to do ... now instead of getting question marks for all the letters that are in arabic .. i have a mix of question marks and english letters.
tell me what was it that we did .. what were those env variables ?
and what other values cxan they have ?
so that i can try the combinations
It's so annoying but i'm sure someone has used it before and made it work.

but thanks for your help anyway
[ May 08, 2002: Message edited by: Kareem Gad ]
Suresh Selvaraj
Ranch Hand

Joined: Nov 14, 2000
Posts: 104
By the way, are you trying to populate the JSP page by retrieving data from Oracle database?
If yes, then you need to do some more settings.
Also, ensure that your default Locale is Arabic - Saudi Arabia. [ check the Regional options ]
Selvaraj Suresh
Kareem Gad
Ranch Hand

Joined: Aug 06, 2001
Posts: 89
no Suresh i'm not using Oracle ... i am connecting to an MS SQL Server databse ..
See Suresh when this page is served thru another jsp engine like orion or apache or whatever .. it comes out right .. just thru iPlanet it gives this problem.
will stay
Kareem Gad
Ranch Hand

Joined: Aug 06, 2001
Posts: 89
Suresh ,
Found the solution
Remember when you mentioned to put cp1256 for the charset in the jsp scriptlet i did just that .. but it was wrong.
The name of the charset turns out to be case sensitive and cp1256 shoul have actually been Cp1256.
for a list of supported encodings and their types you can find them here :
Supported Encodings
[ May 11, 2002: Message edited by: Kareem Gad ]

Joined: Apr 12, 2002
Posts: 3
Hi selva,
I read your replies for Arabic Support on web. I followed teh way you had explained. You also specified taht "whether r u using oracle database" in my case yes ! Please let me know what configurations i need to make on database so that my arabic characters are supported.
I changed teh column to nvarchar2(size) in teh DB column.
In my JSP i used meta tag that uses UTF-8 as charaset !
When i enter the arabic characters it is saved and when i view teh jsp page in teh web it displays the arabic characters prperly. If we repeat this step(of viewing the screen) sometimes it will display few characters as junk ('rectangle shape' will be displyed for few characters). Once it display the few characters as junk then wat ever time u view it will show same junk characters.
And even if i restart jdeveloper it will show few characters as junk.
Even i deployed in Oracle Appserver it shows few characters as junk.
Please help me out in this matter what extra steps i need to do !
I saved JSP page as UTF-8 mode !
I agree. Here's the link:
subject: Displaying Arabic characters on iWS 6
Similar Threads
Arabic language support in JAVA
Unicode convert problem with Jboss in Linux
Decode to NCR problem(urgent)
HTML form data
arabic text from linux to windows oc4j servers