Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Spanish characters not displayed in xml file in Unix

 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Saloon Keeper
Posts: 27926
198
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
I yam what I yam and that's all that I yam - the great philosopher Popeye. Tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic