Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

About persian letters

  Asked By: Lucina    Date: Dec 23    Category: Java    Views: 1896
  

I have some proble about writing a persian web application with JDBC

I have installed an Oracle Database Server 9i with Charset MS Windows Arabic 1256 and even I specified Arabic as supporting language for it

I create some table with string field of type VARCHAR2

for example

CREATE TABLE USR (
ID NUMBER(20) PRIMARY KEY,
NAME VARCHAR(30)
);

and then I try to write into the Persian(Arabic) letters, they are saved in the database and I could see them through Enterprise Manager Consule.

But when I query them for example by SQL Plus or SQL Plus Worksheet or by using a Java Application I can not read the persian letters and It shows me something like this "???????",
Until now I have not tested the saving of user inputs from the JSP/HTML forms into these fields by I think that I have a problem about it too! although the user's input is converted to something for example like "#2343 #2355" but I don't know that they are saved and retrieved as specified or not!


Please help me, I think that my question is a critical subject about all right to left languages including Arabic,Assyrian,Hebrew and Urdo!

Share: 

 

5 Answers Found

 
Answer #1    Answered By: Christie Bradley     Answered On: Dec 23

if you want to see right characters in SQL Plus, you
need to do changes in NLSLang files, also doing some
changes in your registery.

For JSP pages, did you set your content type in JSP
pages?

 
Answer #2    Answered By: Wendy Harrison     Answered On: Dec 23

I had a project with Oracle, Weblogic as web  server and application  server, in persian  language and another one with MS SQL server  and Tomcat.
Let me know, your programming language(Java or Developer), your web server and your RDBMS(Oracle) to help you about code page and more.

 
Answer #3    Answered By: Noah Evans     Answered On: Dec 23

I had a similar problem with MySQL. I solved it by
appending some additional key-value pairs to the
database URL like this:

"jdbc:mysql:///mydb?characterEncoding=UTF-8..."

to let the DB driver no that I'm entering/extracting
UTF-8 values to/from the database. You may have to
specify similar arguments for Oracle. Also if you are
using HTML/JSP don't forget to set the charset:

<meta http-equiv="Content-Type" content="text/html;
charset=utf-8">

In Swing some fonts have problems showing unicode
characters. You have to use an appropriate font for
displaying Farsi letters.

 
Answer #4    Answered By: Candace Foster     Answered On: Dec 23

for inserting and viewing the record with persion fields u must obey
the following steps
1-create a table like this
create table persion(id int,name nvarchar2(30));
(Data type must be NvarChar2)
2-for inserting records ,the insert command must be like this
insert into persion(1,N'Farsi');
(do forget "N" and do this in a jsp or servlet or app,not in SQLplus)
3-if u want see the records,the header of jsp is:

<%@ page contentType="text/html;charset=UTF-8" import="java.sql.*"%>
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
</Head>


notice that u cannot see the farsi records in SQLPlus,but in
EnterPrice Manager u can.and regardless Werbserver u can do it,even in
Linux.

 
Answer #5    Answered By: Arnelle Schmidt     Answered On: Dec 23

For solving your problem do the following:

1-Set your HTML encoding to UTF-8 by using meta tag
2-Set your JSP encoding to UTF-8 by using @page directive
3-Recomended to Set the default encoding of your server  VM to utf-8
by using System.setPropert(...)
4-Recommended to add filters to your application  to change request
and response character encoding to UTF. Java Tutorial has a very good
tutorial
5-In SQL* plus, some changes needed in nls and default font OR
develope a new one with unicode support :)
6-For solving sorting problem create a new encoding file for persian.
Oracle9i has a tool for these purpose. It's simple and fast.
7-compile and deploy ;-)
8-Enjoy your persian  Web Application. ;-)
9-Send an email for me if your problem solved.

 
Didn't find what you were looking for? Find more on About persian letters Or get search suggestion and latest updates.




Tagged: