Results 1 to 13 of 13

Thread: Character Set

  1. #1
    Join Date
    Jun 2003
    Posts
    12

    Question Unanswered: Character Set

    Greetings:

    Well my Oracle DB Server has the Character Set "AL32UTF8". I am accessing the DB server through a client which has the OS: Win 2000 Server English Edition. When I query a table having the japanese words it shows me Junk data instead of those words. I also set the NLS_LANG environment variable on my Client PC with the value of "American_America.WE8ISO8859P1". I restarted the SQL Plus environment and query the table again, but I am still getting the junk data instead of japaneses data. So can anybody help me in solving this problem. Can any body knows how to find the characterset of your system or OS.

    Regards
    kyaqub

  2. #2
    Join Date
    Jul 2003
    Location
    Hong Kong
    Posts
    56

    Re: Character Set

    Try to set the NLS_LANG environment variable on your client PC with the value "American_America.UTF8" in order to tell your Oracle Client to use UTF-8 as character encoding.

    HTH
    Cheers,
    Shev

  3. #3
    Join Date
    Jun 2003
    Posts
    12
    SHEV:

    Thanks for your reply. I have set the client environment variable NLS_LANG to "AMERICAN_AMERICA.UTF8" & restarted the SQL Plus Environment. But its still not working. I am still receiving the junk data from the db server. So any other suggestions

    Regards
    Khalid

  4. #4
    Join Date
    Jul 2003
    Location
    Hong Kong
    Posts
    56
    Originally posted by kyaqub
    SHEV:

    Thanks for your reply. I have set the client environment variable NLS_LANG to "AMERICAN_AMERICA.UTF8" & restarted the SQL Plus Environment. But its still not working. I am still receiving the junk data from the db server. So any other suggestions

    Regards
    Khalid
    Khalid,

    After setting the character encoding to UTF-8, the data retrieved from the Oracle database should now be in the right coding. The reason why you still receive junk data from SQL Plus may be because your SQL Plus does not have the corresponding japanese font to render the japanese data. I guess you are not using Japanese version of SQL Plus, right?

    Try to use iSqlPlus to view the data from the web browser. Remeber to choose Unicode (UTF-8) as the encoding in the web brower. This should work.
    Cheers,
    Shev

  5. #5
    Join Date
    Jun 2003
    Posts
    3
    SHEV:

    Well i does the same as you said, but the thing still isn't working. What I have done is that I have insatlled the iSQL. I have set the font of iSQL editor to a Japanese font (MS Gothic). Then I wrote a insert query in the iSQL editor and execute it. When I write the query I can see the japanese characters correctly, but when I make select query on the same table I see the question marks instead of actual Japanese data. So what to do now. I already set the NLS_LANG environment variable to AMERICAN_AMERICA.UTF8. So how to figure out this. Whats wrong now

    Regards
    Khalid

  6. #6
    Join Date
    Jun 2003
    Posts
    12
    Shev:

    I want to add in some more information which I already given. Please note that the OS of my DB SERVER is Win 2000 Prof Eng Edition. But The Database character set it set to AL32UTF8, in order to support the double byte character sets i.e. the Japanese data. The Client OS is also Win 2000 Prof Eng Edition. So do we have to do any other environment variable setting at the server side also as the OS & DB character sets are different.

    Regards
    kyaqub

  7. #7
    Join Date
    Jul 2003
    Location
    Hong Kong
    Posts
    56
    Khalid,

    After setting the iSQLPlus environment, I think you should be able to view unicode data from the database.

    Now, you have come up with another problem which is failure to insert japanese character into the database through iSQLPlus. As far as I know, the reason why the process failed is that the unicode encoding set in the browser is just for viewing unicode characters. So when you type the insert statement, you can still clearly see all the japanese characters. However, when you process the insert statement, the characters will be encoded based on your Window coding scheme not guaranteed by the encoding of the browser anymore and then inserted to the database. In your case which is an English Win 2000, you might not be able to insert unicode characters directly from either sqlplus or isqlplus. You will need to write program say, .net, to explicitly set the encoding of the characters to Unicode when doing insertion.

    Anyway, I am pretty sure that you will be able to view unicode data now. Oracle database has a sample set of unicode data. Try viewing the table PRODUCT_DESCRIPTIONS under the OE schema with language_id = 'JA'.

    Let me know if you still have problems.
    Cheers,
    Shev

  8. #8
    Join Date
    Jun 2003
    Posts
    12
    Shev,

    Thanks again for your reply. Well now I also have Japanese Language Pack installed on my system. Now what I am doing is that I am making a simple form in VB.Net to insert the japanese data in the oracle database. But the problem is still there. When I type the data in the forms field it is in the correct format but when I select back the data it show me the junk data or the question marks. Well I am really upset now to how to over come this problem and what I am doing wrong. So can you have any other suggestions.

    Regards
    Khalid

  9. #9
    Join Date
    Jul 2003
    Location
    Hong Kong
    Posts
    56
    Khalid,

    Have you explicitly set the encoding to Unicode when reading/writing the text from/to the form? You can post your code and let me have a try. I have done similar thing before, and it works fine with me.

    By the way, can you view the unicode data in PRODUCTION_DESCRIPTIONS? This ensures that you have no problem viewing unicode data first.
    Cheers,
    Shev

  10. #10
    Join Date
    Jun 2003
    Posts
    12
    Shev:

    In your last reply you have said:

    "Have you explicitly set the encoding to Unicode when reading/writing the text from/to the form?"

    What you mean by this. I am working in VB.Net. And I am displaying the data in the data grid for which I set the Font to MS Gothic with the japanese script. Also for the form, I also set the Language property to Japanese. But its still not working. I query the Product_Descriptions table but I still see the junk data.

    Also In one of your previos posts, you asked to set the NLS_LANG environment variable to UTF8. I have a little doubt on this value. I think we should set the NLS_LANG parameter to the value which represents the encoding sceheme of the client platform i.e. the OS. As when the data comes from different encoding scheme, the oracle client libraries can concert the data for us. I also tried that, but its still not working. So what you say about that.

    Again I want to remind that my Oracle DB Server is in Unicode format with the NLS_CHARACTERSET set to AL32UTF8. And the DB server platform is Win 2000 Prof English Edition. The client platform is Win 2000 Prof Eng Edition with the japanese language pack installed on it.

    I am also attaching my simple VB.Net program with the post. But you have to make the changes in the Connection control to connect to your DB Server.

    Well I am really greatfull to you for the time that you are giving me to solve my problem. So nice of U.

    Regards
    Khalid
    Attached Files Attached Files

  11. #11
    Join Date
    Jul 2003
    Location
    Hong Kong
    Posts
    56
    Khalid,

    I forget to remind you one thing which is the data driver. You will need to use driver which supports unicode. In your program, you have used MS OLE Db for Oracle. I think this one does not support unicode. Try to use ODP.Net by Oracle or Microsoft ODBC.NET Data Provider. I have tried both drivers before, they work fine with me.

    I suggest you try viewing the content in PRODUCTION_DESCRIPTIONS through iSQLPlus first. See if it works or not before bringing more uncertain problems in the VB.Net.

    Below is my answers for your questions:

    ...And I am displaying the data in the data grid for which I set the Font to MS Gothic with the japanese script. Also for the form, I also set the Language property to Japanese. But its still not working. I query the Product_Descriptions table but I still see the junk data.
    You will need to use Unicode font to render unicode data.

    ...Also In one of your previos posts, you asked to set the NLS_LANG environment variable to UTF8. I have a little doubt on this value. I think we should set the NLS_LANG parameter to the value which represents the encoding sceheme of the client platform i.e. the OS. As when the data comes from different encoding scheme, the oracle client libraries can concert the data for us. I also tried that, but its still not working. So what you say about that.
    No, NLS_LANG parameter must be set to use UTF8 encoding if retrieving unicode data. This is dealt with which encoding scheme Oracle retrieves data from the database. It does not relate to the language settings in OS.

    ...Again I want to remind that my Oracle DB Server is in Unicode format with the NLS_CHARACTERSET set to AL32UTF8. And the DB server platform is Win 2000 Prof English Edition. The client platform is Win 2000 Prof Eng Edition with the japanese language pack installed on it.
    I think there is not necessary for you to install the japanese language pack for your OS. As long as you have a Unicode font, eg Arial MS Unicode, you will be able view unicode data in the .Net form. Remember .Net supports unicode, it will take care the encoding for you.

    Let me know if you can view in iSQLPlus.
    Cheers,
    Shev

  12. #12
    Join Date
    Jun 2003
    Posts
    12
    Shev:

    Thanks for ur reply again. You got it. I was using the wrong Data Driver. I was using MS OLEDB Provider For Oracle. Now I have downloaded the ODP.NET and installed it. And my VB.NET Application is working now. I can insert & view the japanese data now.

    Well I was unable to make a test with the iSQL Plus as my Oracle HTTP server is not configured properly and I don't have the rights to take a look at it.

    But a very strange thing is happening now. Just for testing, I have deleted the NLS_LANG Environment Variable. And run again my application. The interesting thing is that my application is still working. I still can see the japanese data and can also insert it. So what you say about that?

    But anyways THANK YOU very much for solving my problem. I am so greatful to YOU.

    Regards
    Khalid

  13. #13
    Join Date
    Jul 2003
    Location
    Hong Kong
    Posts
    56
    Khalid,

    Glad to know that your problem has been solved.


    ...But a very strange thing is happening now. Just for testing, I have deleted the NLS_LANG Environment Variable. And run again my application. The interesting thing is that my application is still working. I still can see the japanese data and can also insert it. So what you say about that?
    Really? Actually, I have never setup a NLS_LANG environment variable. I edit the registry directly. Try to see what value under the below key.

    HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\HOME0\NLS_LANG


    I just query that it might be because you have installed the japanese language pack, together with the japanese font, so you have no problem editing japanese data. You are still using the MS Gothic for japanese, right?

    I doubt if you can insert/view unicode data in other languages.
    Cheers,
    Shev

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •