This discussion is archived
4 Replies Latest reply: Jun 27, 2010 11:54 AM by DarrylBurke RSS

Java -Arabic text(????)

843810 Newbie
Currently Being Moderated
Hi all,

Need help on this.
When a user enters arabic name and password I am supposed to retrieve data for that user.In java I am using utf-8 encoding
I am supposed to retrieve data in the form of arabic text from the database.The database I am using is sql server 2005. and the column is set as varchar instead of nvarchar.Since the database is pointing to production. I could not change the column type to nvarchar. Is there any way to convert the ???? text retrieved from database into arabic text without making changes to DB.

thnx in advance
shushant
  • 1. Re: Java -Arabic text(????)
    843810 Newbie
    Currently Being Moderated
    Can i ask you a couple of questions
    1. Can you store Arabic text in you DB to be precise what i want to know is if you fire a select query on your table, do you see Arabic text or do you see "????"
    2. Is you application a web application or a Desktop application?

    Edited by: javigam on Jul 16, 2009 4:09 AM
  • 2. Re: Java -Arabic text(????)
    843810 Newbie
    Currently Being Moderated
    hello, i am going through (perhaps) the same problem, my project is a desktop application:

    i can MANUALLY store arabic text in my database (directly in SQL Sever Query Analyzer) but if i want to retrieve the arabic text in a query in JAVA (for example:
    select * from person
    ) i see weird characters (not question marks) but not the original arabic text
    and if i type arabic text in a java textfield and use the value entered in an sql query, for example:
    sqlQuery = "insert into person (fname) values ('" + jtfFName.getText() + "')";
    it is inserted in SQL Server as ?????s and when i retrieve the values from the table i also see it as ?????s

    even when i converted all the data types in the database to unicode data types (*nchar* instead of char and nvarchar instead of varchar) and modified the sql query to the following:
    sqlQuery = "insert into person (fname) values (N'" + jtfFName.getText() + "')";
    (N outside the single quotation mark since according to rules on msdn)
    it still didn't solve the problem

    please i need urgent help with this issue!

    -----------------------------------

    problem was solved by setting the charSet encoding to "UTF-8" in the connection to sql server using the jdbc-odbc bridge

    Edited by: toufic26 on Sep 6, 2009 2:28 PM
  • 3. Re: Java -Arabic text(????)
    843810 Newbie
    Currently Being Moderated
    Hi Shushant,
    I am facing the same issue now.
    Will you please suggest how exactly you solved this issue with arabic data?
    Prompt reply would be highly appreciated.
  • 4. Re: Java -Arabic text(????)
    DarrylBurke Guru Moderator
    Currently Being Moderated
    meetdeeps, welcome to the forum. Please don't post in threads that are long dead and don't hijack another poster's thread. When you have a question, start your own topic. Feel free to provide a link to an old post that may be relevant to your problem.

    I'm locking this thread now.

    db