Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Can use BOM and SEP at the same time

Posted on 2014-02-24
4
Medium Priority
?
573 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

This article describes a serious pitfall that can happen when deleting shapes using VBA.
This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.
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…
Suggested Courses

609 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