Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Spanish characters not displayed in xml file in Unix

 
Sarah Gaikwad
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Sarah Gaikwad
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 18303
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Sarah Gaikwad
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic