You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Arthur Gaudio <ar...@bostream.nu> on 2004/02/02 18:37:12 UTC

EBCDIC and POI

Hello,

I am facing a problem that I think other users have reported in the past,
but I cannot seem to find any information. I am using POI to create an Excel
file in my Web application. I then send this on to the user via the response
object's ServletOutputStream. This works just fine. The idea is that the
user saves the file, makes some changes and then uploads the file back to
the server via a MultipartRequest (O'Reilly). Some of the cell data is
non-Western (Japanese, Chinese, etc) and some of it is Western languages. I
encode all the data with the UTF16 flag in POI. The problem is that the
server running WebSphere is on an OS/390 machine with EBCDIC. For some
reason, when reading the Excel file after upload, I am only able to retrieve
the non-Western data using

	HSSFCell.getStringCellData()

Calling the same method for strings in Western languages (Swedish, English,
etc.) just results in a bunch of garbled text. However, if I retrive a
string, call String.getBytes() to get the byte encoding in the system's
default EBCDIC encoding (Cp1047), and then pass this byte array into a new
String(bytes, "iso-8859-1"), then I get out the information I expect to
find. Are the non-Western languages the only ones being saved with UTF-16?
Is there a problem when POI converts from EBCDIC to ISO-8859-1? I am not
exctly sure I understand the problem, but it seems to be along these lines.
I want to be able to encode everything in UTF-16, since I won't know in
advance what type of data will be in which cells.

Any suggestions would be greatly appreciated. Thanks!!!

/Arthur Gaudio

******************************
Arthur Gaudio

tel:   +46 8 29 45 40
mob:   +46 70 778 14 70
email: arthur.gaudio@bostream.nu
******************************



---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: poi-user-help@jakarta.apache.org