473,324 Members | 2,356 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

wirting special characters out to excel in HTML

We have a web-based reporting application written in J2EE
that writes out to excel using response.setContentType
("application/vnd.ms-excel; ")….

The problem is that where we have any special characters
in our report result set E.g umlauts and accents ( ASCII
values 128 to 165 ) this data is corrupted, and does not
appear correctly.

The standard font family used throughout our Web Reports
is Arial,
I have seen this handled by using Verdana, however we are
reluctant to change the fonts in all our reports.

I believe this relates to Excel performing a unicode
translation, unfortunately we require Excel functionality
to enable users to perform operations on the finished
reports.

Is there a font family similar in appearance to Arial that
will handle the unicode character set?
Or is there a mechanism to tell Excel not to perform this
conversion?

thanks.

Jul 21 '05 #1
5 10409
Matthew Shaw <ma**********@hotmail.com> wrote:
We have a web-based reporting application written in J2EE
that writes out to excel using response.setContentType
("application/vnd.ms-excel; ")….

The problem is that where we have any special characters
in our report result set E.g umlauts and accents ( ASCII
values 128 to 165 ) this data is corrupted, and does not
appear correctly.
There *are* no ASCII values 128-165. ASCII is 7-bit.

Now, when you say the data is "corrupted", what exactly happens?
Perhaps it's writing it out in UTF-8 or something similar? How are you
writing out the data in the first place, exactly? (i.e what file
format, etc.)
The standard font family used throughout our Web Reports
is Arial,
I have seen this handled by using Verdana, however we are
reluctant to change the fonts in all our reports.

I believe this relates to Excel performing a unicode
translation, unfortunately we require Excel functionality
to enable users to perform operations on the finished
reports.

Is there a font family similar in appearance to Arial that
will handle the unicode character set?
I'd be very surprised if it were the font which was at fault here -
althoguh I could certainly be wrong.
Or is there a mechanism to tell Excel not to perform this
conversion?


How exactly are you exporting from Excel? Or are you only *importing*
into Excel? If you can specify somewhere which character encoding to
use, and make sure you use the same one everywhere, you should be okay.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jul 21 '05 #2


We are only importing into Excel. You can explicitly provide a character
encoding...

E.G application/vnd.ms-excel;charset=ISO-8859-1

which I believe is default, others include charset=windows-1251.

They do appear to be producing slightly different results, however none
of the ones I have tried can handle umlauts...

thanks.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 21 '05 #3
Matthew Shaw <ma**********@hotmail.com> wrote:
We are only importing into Excel. You can explicitly provide a character
encoding...

E.G application/vnd.ms-excel;charset=ISO-8859-1
Right - but if you explicitly provide the charset there, do you also
make sure your J2EE app is actually *using* that character set?
which I believe is default, others include charset=windows-1251.
Ah - if you're using 1251 that may well give different results to
ISO-8859-1. If you can get both sides to use UTF-8 I believe that's the
most likely to work for everything in a simple fashion.
They do appear to be producing slightly different results, however none
of the ones I have tried can handle umlauts...


Hmm... well, I hope the above is helpful...

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jul 21 '05 #4


I have tried the following
"application/vnd.ms-excel;charset=windows-1251",1250,1252

I believe the default is charset=ISO-8859-1

they do look as though they are altering the imported characters,
although they appear either as . , or ? , or just those wierd square
things that you get when you open a file using an editor that doesn't
support the file format.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 21 '05 #5
Matthew Shaw <ma**********@hotmail.com> wrote:
I have tried the following
"application/vnd.ms-excel;charset=windows-1251",1250,1252

I believe the default is charset=ISO-8859-1

they do look as though they are altering the imported characters,
although they appear either as . , or ? , or just those wierd square
things that you get when you open a file using an editor that doesn't
support the file format.


Hmm. Thing is, if it's really writing an Excel spreadsheet then it's a
binary file to start with, which is part of what confuses me - unless
it's actually just writing CSV data and using the content-type to
direct it to Excel...

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jul 21 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Barry Olly | last post by:
Hi, I'm working on a mini content management system and need help with dealing with special characters. The input are taken from html form which are then stored into a varchar column in...
1
by: quickcur | last post by:
I am rewrite some of my excel sheets to xml document. In my excel, there is a lot of special characters like "/", " " (space), "#", "+'. I am using a java program based on JDom to to create xml....
1
by: Tim | last post by:
I am exporting a dataset to Excel. I can successfully view the dataset in Excel however, there are special characters that are appearing in the form of Â, â€" and others. My code in C# starts...
5
by: Matthew Shaw | last post by:
We have a web-based reporting application written in J2EE that writes out to excel using response.setContentType ("application/vnd.ms-excel; ")…. The problem is that where we have any special...
3
by: orgelizer via AccessMonster.com | last post by:
I'm trying to enter some specific special characters (Ω, ±, ≥, ≤ for example) in Access. Knowing that ASCII should be ASCII, but with variations (the spice of life, right?), using the "Hold...
3
KevinADC
by: KevinADC | last post by:
Purpose The purpose of this article is to discuss the difference between characters inside a character class and outside a character class and some special characters inside a character class....
2
by: umeshchitta | last post by:
Hi ALL, I written code to download data in Excel from webpage in PLSQL. i have used owa_util.mime_header to write data in excel.But if data cmng from db table is "32E104" then data in Excel...
2
by: matech | last post by:
I have a problem with uploading special characters from excel files to mysql 5. It doesn't matter if I use UTF-8 or iso-8859-1 when uploading the trademark ™ symbol. htmlspecialchars() or...
0
by: jpero09 | last post by:
Having some trouble writing out accented characters to an ms-excel type output from my asp.net page (c#). I've tried a few different charsets but every time the è on my page is getting rendered as...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.