aspose file tools*
The moose likes Linux / UNIX and the fly likes Spanish characters not displayed in xml file in Unix Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "Spanish characters not displayed in xml file in Unix" Watch "Spanish characters not displayed in xml file in Unix" New topic
Author

Spanish characters not displayed in xml file in Unix

Sarah Gaikwad
Ranch Hand

Joined: Feb 26, 2004
Posts: 35

I have a Reports.war file. This war file reads a csv file on the filesystem and generates an xml file(saved onto the filesystem) from it.

Scenario in windows
The generated xml file displays the accented/tildes on the spanish characters correctly.
eg: <field name="alert_master_id">TESTSIVA19Inter Téléfónícá</field>


Scenario in Unix

The generated xml file displays the accented/tildes on the spanish characters incorrectly.
eg:<field name="alert_master_id">TESTSIVA19Inter T?l?f?n?c?</field>

Note: Its the same war with the same csv file. It produces 2 different results.


Any help is deeply appreciated.

Thanks
Sarah
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39544
    
  27
How are you handling encoding when generating the XML file? If you use the default encoding, then that'll be different between Windows and Unix.


Ping & DNS - updated with new look and Ping home screen widget
Sarah Gaikwad
Ranch Hand

Joined: Feb 26, 2004
Posts: 35
Thanks for the response

Here a sample xml that gets created with its encoding

<?xml version="1.0" encoding="ISO-8859-1" ?>
<report-list date="2008-12-22T00:00:00">
<report id="notifications_by_event">
<report-data>
<rowset>
<row>
<field name="date">2008-12-22T00:00:00</field>
<field name="alert_master_id">TESTSIVA19Inter Téléfónícá</field>
<field name="content_id">SP1000.admin.TESTSIVA19Inter1</field>
<field name="event_content">null</field>
<field name="total">1</field>
</row>
</report-data>
</report>
</report-list>
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39544
    
  27
That just shows what encoding is specified in the XML file. The more important question is: are you actually using that encoding for generating the file? If you're not explicitly specifying an encoding, then the platform default encoding is used - which on Unix is probably not ISO-8859-1.

The next question is: where are you seeing those question marks? Is it somewhere where you can be sure that accented characters would be displayed correctly?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15632
    
  15

Ulf Dittmer wrote:That just shows what encoding is specified in the XML file. The more important question is: are you actually using that encoding for generating the file? If you're not explicitly specifying an encoding, then the platform default encoding is used - which on Unix is probably not ISO-8859-1.


Actually, at least for Linux, I'm fairly sure that the encoding is ISO-8859-1. It's Windows I'm less certain of. Windows likes Windows-1252, which I think grew out of the IBM 8-bit ASCIIZ extension to the original 7-bit ASCII code.

A lot of XML tools prefer you use UTF-8 to encode the XML, however.


Customer surveys are for companies who didn't pay proper attention to begin with.
Sarah Gaikwad
Ranch Hand

Joined: Feb 26, 2004
Posts: 35
That just shows what encoding is specified in the XML file. The more important question is: are you actually using that encoding for generating the file? If you're not explicitly specifying an encoding, then the platform default encoding is used - which on Unix is probably not ISO-8859-1.



Thats for this point. The code did not explicitly set an encoding hence it picked up the encoding set at the os level. In case of unix it was set to C(thus explaining why it was not working on the unix system).The windows system had the encoding set to Latin-1 (which was what I needed).

I modified the code to explicitly set the encoding and voila! it worked .

Thanks so much.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Spanish characters not displayed in xml file in Unix
 
Similar Threads
Castor unable to Map - please help
Compression/Decompression encoding in unix.
Ajax response and accented characters (richfaces)
Corrupt file name after compression.
UTF-8 problem again, but still little diffrent