1 2 Previous Next 17 Replies Latest reply: Oct 29, 2008 4:03 AM by flavioc RSS

    csv download problem

    665260
      Hi,

      I have a report for which I have put CSV download. In this report, we have Chinese, Janpanese, English charactors. I downloaded it from a Simplified Chinese Windows box. When I open the file with Excel, the Chinese and Janpanese are garbled.

      How to fix this problem?

      Now, I turn on the "Automatic CSV Encoding", should I trun it off?

      Thanks a lot!
        • 1. Re: csv download problem
          flavioc
          Hi,
          what is the "derive language" setting in your application?
          And what is the current browser language setting?

          Bye,
          Flavio

          ----------------------------------------
          http://www.oraclequirks.com
          • 2. Re: csv download problem
            665260
            "derive language" is "Use Application Primary Language" and "Application Primary Language" is "English(United States)(en-us)"

            The current browser language is "en-us"

            Thanks!
            • 3. Re: csv download problem
              flavioc
              ok, my understanding is that Apex (with the automatic conversion setting on) is possibly converting into Win1252 or analogous western character set.

              if you turn off the setting and the db is AL32UTF8, you should get the output encoded in UTF-8.
              At that point, you must ensure that you can load the data into the spreadsheet as UTF-8.

              Bye,
              Flavio

              ----------------------------------------
              http://www.oraclequirks.com
              • 4. Re: csv download problem
                665260
                I wonder whether it means the Chinese is corrupted if the file is converting into Win1252.
                If yes, do we have any way to download and open it using Excel without garbage?

                Thanks a lot!
                • 5. Re: csv download problem
                  flavioc
                  Certainly it will be, because Win1252 is a single byte character set while chinese (i am not an expert of chinese, but just to clarify, i know there is more than one chinese charset) in AL32UTF8 is represented by multi-byte characters, so, essentially you are getting 2, 3 or 4 junk characters for each chinese glyph, that's why your output is garbled.

                  As i said, the best option would be to open the CSV file specifying at the time of import that it's UTF-8 encoded.
                  Unfortunately i can't be more specific on how to do this in Excel because i haven't MS Office installed and the download of openOffice 3.0 for the Mac is underway in this very moment, so may be i can come up with some more info later on.

                  Bye,
                  Flavio

                  -----------------------------------
                  http://www.oraclequirks.com
                  • 6. Re: csv download problem
                    flavioc
                    Hi,
                    i made a test creating an application with the "Automatic CSV Encoding" turned off.
                    You can try it out at:

                    http://apex.oracle.com/pls/otn/f?p=42829:1:0

                    Then i opened the spreadsheet using OpenOffice 3.0 for Mac, choosing UTF-8 as encoding and i got exactly the same strings.

                    If the japanese or the chinese text does not make sense, please forward your claim to Google Translate... ;-)

                    Bye,
                    Flavio

                    -----------------------------------
                    http://www.oraclequirks.com
                    • 7. Re: csv download problem
                      665260
                      Thanks for your help!
                      • 8. Re: csv download problem
                        628828
                        Hi Flavio,

                        I'm having the same problem with the Chinese and Japanese characters.
                        I've turned off the "Automatic CSV Encoding" option in the Globalization Attributes as you recomended but I don't know how to modify the database to AL32UTF8.
                        Can you please help me with that ?

                        Thanks,
                        Adela
                        • 9. Re: csv download problem
                          flavioc
                          Adela,
                          you can't change the character set in any easy way, it would be much easier to create a new database using AL32UTF8 character set.

                          Just as a curiosity, what do you get if you run the following query?

                          select *
                          from nls_database_parameters
                          where parameter = 'NLS_CHARACTERSET';

                          Flavio

                          -----------------------------------------
                          http://www.oraclequirks.com
                          • 10. Re: csv download problem
                            628828
                            This is the result :
                            PARAMETER     VALUE
                            NLS_CHARACTERSET     AL32UTF8

                            I'm confused. Why than do I still get garbled data? When opening the csv file with notepad, the data looks ok, but opening it with the Excel will still be garbled.
                            I do have to mention the fact that due to the fact that I'm in EMEA I have to replace "," with ";" in my csv file to be able to properly read it in Excel.
                            Any sugestions or ideas to get this soleved would be very much apreciated.

                            Thanks and Regards,
                            Adela
                            • 11. Re: csv download problem
                              flavioc
                              Does Excel ask you for the encoding when opening the file?
                              OpenOffice 3.0 when importing the file allows one to choose the file encoding, so if one pick UTF-8, it seems to work.

                              Bye,
                              Flavio

                              ----------------------------------------
                              http://www.oraclequirks.com
                              • 12. Re: csv download problem
                                628828
                                No, it dosn't ask me.
                                But event if it would, I need this solution to be available across the world, not only on my local machine.

                                Thanks,
                                Adela
                                • 13. Re: csv download problem
                                  flavioc
                                  Adela,
                                  unfortunately i could only try out the operation on an old Excel 2002 version and it's somewhat tricky and i don't know if excel 2007 is any better.

                                  In excel 2002 if the CSV extension is associated with the program, actually the file is opened without asking for any encoding.
                                  But if you rename it to .txt, then a more elaborated import process starts asking for the file encoding among other things like field separators and so on.

                                  It seems to me that OpenOffice 3.0 is much smarter than MS Office in this area.

                                  This was the result of a quick check, i ignore if there are any preferences controlling the file import that can make your life easier.

                                  Bye,
                                  Flavio

                                  ----------------------------------------
                                  http://www.oraclequirks.com
                                  • 14. Re: csv download problem
                                    628828
                                    So there's no way to fix this problem within APEX?
                                    1 2 Previous Next