3 Replies Latest reply: Sep 8, 2009 10:52 AM by 843810 RSS

    java-Arabic

    843810
      hi,

      i am reading arabic text from csv file,for file reading i m using

      BufferedReader br = new BufferedReader(InputStreamReader(new FileInputStream((file),"ISO-8859-6")))

      in the same class itself, I am displaying that arabic text in JTextFiled,its displaying as Arabic.

      When i am inserting that arabic text into SQL Server 2003,its storing as Question Mark(?????????).

      the Arabic Text field data Type is Nvarchar, and i am adding N to Prefix of Arabic Text


      How to solve this Problem(its java Swing Application)
      its Vary Urgent,
      any one can help me
      Thank You
        • 1. Re: java-Arabic
          843810
          when you save the data to SQL server you must converted to Unicode first
          • 2. Re: java-Arabic
            843810
            can you please show me how? because i'm going through the same problem and i need a solution very soon!
            if possible, can you provide a working example?

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

            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
              843810
              Try
              Charset.forName("utf-8").newEncoder().encode(in)
              If the text was correctly read than the data should be available as UTF-16 in the memory. Converting it with this call should help if utf-8 is required. Remember that you get a ByteBuffer of which you can call the array() method to retrieve the raw data.

              Hope that helps.
              Matthias