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
Solved

Can use BOM and SEP at the same time

Posted on 2014-02-24
4
488 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
4 Comments
 
LVL 35

Accepted Solution

by:
mccarl earned 500 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Microsoft Office Picture Manager is not included in Office 2013. This comes as a shock to users upgrading from earlier versions of Office, such as 2007 and 2010, where Picture Manager was included as a standard application. This article explains how…
This article will shed light on the latest trends when it comes to your resume building needs. For far too long, the traditional CV format has monopolized the recruitment market.
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

839 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