• 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

generating valid xml with irish fada

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
i am generating xml in java using XMLSerializer.
the generaeted code is exactly as i want it but it is failing the build process as the xml content has important special characters e.g. "�" within.
it says:

Error reading propject file <filename> Invalid byte 1 of 1-byte UTF-8


Any ideas?
thanks
Thomas
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you defining the encoding your XML file uses? It sould start with:
 
Thomas Murphy
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Paul,
Yes i think so at least it does appear in the xml document from the following code:


The xml is fine when i look at it in textpad but explorer doesnt like it...
Tom
 
Paul Sturrock
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


explorer doesnt like it


Internet Explorer?

(By the way - be aware that Textpad does not support Unicode, so I'd use a better editor for XML. The one that comes with Eclipse for example)
[ December 18, 2006: Message edited by: Paul Sturrock ]
 
Thomas Murphy
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Paul...
Yes Internet Explorer
I then tried using a ù in place of �...still no joy
then i tried opening in wordpad.
and get this:
My incorrect file reads properly but i found another xml file that reads �� for � i used this (replaced ù with ��) and it works.
whether its a complete solution remains to be seen!
cheers for your help there...
Thomas
 
Thomas Murphy
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
haha
okay now i undersatnd better...
my last post was encoded on submit to make everything more clear
 
Paul Sturrock
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
IE is just using its own parser to display the XML file; I'm not sure I'd rely on it. I'd try using another, more dependable one. Assuming you created the file in an editor that supports Unicode there should be no problem using this character.
 
Thomas Murphy
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
well i have found the root of the problem i think.
I am using a FileWriter object and an OutputFormat with conflicting encodings.



Unfortunately you cannot set an encoding on a FileWriter object.
Using this should work though:
 
Thomas Murphy
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This issue now resloved see below:



Thanks
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic