Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2011

    Unanswered: Exporting UTF8 chars to text file

    I'm using DB2 9.7 FP4 with a UTF-8 database.

    One of the columns in the table contains Japanese characters, and I can see them in Control Center and Command Editor, however, I can't get them into an exported file.

    If I use the export function in Command Editor, the resulting file just has hex 3F where the DBCS chars should be, one per character. I've also tried simple queries from a command window, and those just contain -> (single right arrows).

    Is there any way to generate a UTF-8 compliant output file?

  2. #2
    Join Date
    Apr 2012
    Provided Answers: 17
    Are you using the codepage=... qualifier for the export command, per the documentation?

    Alternatively if your client is Linux/Unix: ensure LANG variable is correctly set (to support the correct locale for utf-8 for your operating system), before using the command-line export command.

    If you are using a Windows client of db2, you can either use the 'codepage=...' qualifier per the documentation, or you can use the registry variable DB2CODEPAGE=1208 before export.

  3. #3
    Join Date
    Nov 2011
    Yes. This is on windows.

    C:\DB2>set DB2CODEPAGE=1208
    C:\DB2> db2 export to test.csv of del select * from testdb.testtb
    SQL3104N  The Export utility is beginning to export data to file "test.csv".
    SQL3105N  The Export utility has finished exporting "1" rows.
    C:\DB2> notepad test.csv

    it actually has 5 arrows with this -> between the quote marks.

    notepad has it's font set to MS PMincho with Japanese script set.

    I had also run
    C:\DB2>db2set DB2CODEPAGE=1208
    in the CLP session prior to the above test


    I then tried "of del modified by codepage=1208 ...." and it worked as I expected.

    Last edited by rnem170; 10-08-13 at 09:17.

Posting Permissions

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