?
Solved

Can use BOM and SEP at the same time

Posted on 2014-02-24
4
Medium Priority
?
535 Views
Last Modified: 2014-03-03
We need to export a file in csv formatted file from java that contains foreign language characters.  We can do this by putting the BOM information on the first line but we also need to have the sep=, on the first line as in Europe their machines default to a semicolon as the separator.  (This is a customer facing application and we can't have them change the separator in windows)

It seems that you can't do both at the same time.  If we use the BOM it put all the columns in the first column and if we use sep= it separates them out but the language is all garbage.

UTF8_BOM = "\uFEFF";
sep=,
0
Comment
Question by:Lynnifer
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 36

Accepted Solution

by:
mccarl earned 1500 total points
ID: 39893998
@Lynnifer

Is this question related to importing the resulting CSV files into something? And is that something MS Excel?

The rest of this post assumes the above to be correct...

It appears that this is something that others have encountered but seems to just be "not possible" in Excel. Refer to these forum posts...

http://social.microsoft.com/Forums/en-US/33cca906-e279-4714-a8af-eb0e02593e24/open-utf8-csv-file-with-sep-loose-encoding?forum=Offtopic
http://social.msdn.microsoft.com/Forums/office/en-US/ed67b453-ec8b-4384-9833-b51835a720af/csv-file-encoding-in-excel-2007?forum=exceldev

Is generating a different format file a possible solution? For example, if you generate an XML file in a (fairly basic) format like the below, you won't have any separator issues and XML supports UTF-8 with no problems.

Book1.xml
<?xml version="1.0"?>
<?mso-application progid="Excel.Sheet"?>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
 xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet">
 <Worksheet ss:Name="Sheet1">
  <Table>
   <Row>
    <Cell><Data ss:Type="Number">1</Data></Cell>
    <Cell><Data ss:Type="Number">2</Data></Cell>
    <Cell><Data ss:Type="Number">3</Data></Cell>
   </Row>
   <Row>
    <Cell><Data ss:Type="String">Þ§</Data></Cell>
    <Cell><Data ss:Type="DateTime">2014-02-28T00:00:00.000</Data></Cell>
    <Cell><Data ss:Type="String">BLAH</Data></Cell>
   </Row>
  </Table>
 </Worksheet>
</Workbook>

Open in new window

It will load into Excel. It did using Excel2010 on my machine, but I'm sure that this would be fairly compatible with most recent versions. My win7 PC was able to tell that this .xml file had special Excel content in it and so it opens directly from an Explorer window.

You could also investigate the above XML format more deeply and do more things than you can with a simple CSV, ie. such as set cell styles, column widths, etc, etc.
0
 

Author Comment

by:Lynnifer
ID: 39900450
yes, we need to import it into Excel, sorry I didn't make that clear.  I think we came to the same solution as you.  I will go over your alternatives with my team mates and see if any of them are an option.
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn different types of Android Layout and some basics of an Android App.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses
Course of the Month9 days, 1 hour left to enroll

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question