views:

42

answers:

2

I hava a table in ms sql2000 with a column defined as nvarchar

when query this table in java i get data for this column like this :

يا هلا بالشباب الحلوين يا شباب ا٠شلونكو؟.

When i try php with adodb i get the data as it should be ,in arabic.

but i need to use java not php ,please can any one help me.

  • i use a normal sql statement "select * from news"
  • i use the latest Microsoft jdbc driver(sqljdbc4.jar).
  • i have no direct access to the sql server.
A: 

That looks to me like an encoding issue, make sure you're using the proper encoding in Java to get the text back. Some variant of unicode obviously.

Myles
A: 

At every character processing step (getting data, modifying data, saving data, displaying data, etcetera) ensure that you're using UTF-8 character encoding.

If it is a client application, you usually only have to worry about it in the database table and if necessary also the JDBC connection string.

If it is a webapplication, then you need to take more into account: request and response encoding. For GET requests this is an appserver setting and for POST requests and all responses you can set it in the appropriate request/response objects.

BalusC