Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > JAXB and Arabic encoding

Reply
Thread Tools

JAXB and Arabic encoding

 
 
Brahim Machkour
Guest
Posts: n/a
 
      07-25-2003
Hello,

I'm using JAXB to export/import data from/to a DB through XML files.
Everything is working well. I would like also to be able to edit
the file using an editor, typically XMLSpy. The problem is that
within the XML the arabic text is encoded with strings such as
"& #1578;& #1575;& #1585"... and using the editor, arabic does not
appear, only the sequence of ascii strings i just mentioned. I edit
manually and replace with arabic charater, then they show up in
XMLSpy. I guess it's an encoding problem at marshalling ?

I've tried anything I can at the marshalling step using :

> Marshaller m = jc.createMarshaller();
> m.setProperty( Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE );
> m.setProperty( Marshaller.JAXB_ENCODING, "ISO-8859-6" );
> m.marshal(xmldata, new FileOutputStream(xmlfile));


still the same thing. tries UTF-8, CP1256, Windows-1256, ...

Is there a way to have arabic charaters directly showing up in
the XML ?

Thank you for any help

Brahim.
 
Reply With Quote
 
 
 
 
Mark Thornton
Guest
Posts: n/a
 
      07-26-2003
Brahim Machkour wrote:

> Hello,
>
> I'm using JAXB to export/import data from/to a DB through XML files.
> Everything is working well. I would like also to be able to edit
> the file using an editor, typically XMLSpy. The problem is that
> within the XML the arabic text is encoded with strings such as
> "& #1578;& #1575;& #1585"... and using the editor, arabic does not
> appear, only the sequence of ascii strings i just mentioned. I edit
> manually and replace with arabic charater, then they show up in
> XMLSpy. I guess it's an encoding problem at marshalling ?
>
> I've tried anything I can at the marshalling step using :
>
>
>>Marshaller m = jc.createMarshaller();
>>m.setProperty( Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE );
>>m.setProperty( Marshaller.JAXB_ENCODING, "ISO-8859-6" );
>>m.marshal(xmldata, new FileOutputStream(xmlfile));

>
>
> still the same thing. tries UTF-8, CP1256, Windows-1256, ...
>
> Is there a way to have arabic charaters directly showing up in
> the XML ?
>
> Thank you for any help
>
> Brahim.


You have to use a 'transcoder' which knows what characters can be
represented directly in the selected encoding. Many transcoders will
take the easy way out and just put everything not in ASCII as a
character reference. Note that prior to the addition of the Charset
classes in 1.4 it was tedious to determine if a given character set
supported a character.

Mark Thornton

 
Reply With Quote
 
 
 
 
Alan J. Flavell
Guest
Posts: n/a
 
      07-27-2003
On Sat, Jul 26, Roedy Green inscribed on the eternal scroll:

> If they did, it would not be XML any more. XML is designed to make
> handling un-American characters difficult.


Bloody trolls.
 
Reply With Quote
 
Jon A. Cruz
Guest
Posts: n/a
 
      07-27-2003
Roedy Green wrote:
> On 25 Jul 2003 01:25:54 -0700, (Brahim Machkour)
> wrote or quoted :
>
>
>>Is there a way to have arabic charaters directly showing up in
>>the XML ?

>
>
> If they did, it would not be XML any more. XML is designed to make
> handling un-American characters difficult.



Not at all.

The one thing an XML parser must support to claim it is an XML parser is
Unicode.

Just Use UTF-8 on the XML file and view it in Notepad. You can even have
Arabic identifiers.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
encoding - arabic(IBM 864) to UNICODE Madhu Alagu Python 2 03-18-2007 01:26 PM
Arabic Language support and Unicode Performance Hari Shankar ASP .Net 3 07-31-2006 01:43 PM
Web form and Arabic characters... Greg ASP .Net 4 03-03-2004 08:17 AM
JAXB and Arabic encoding Brahim Machkour XML 3 07-27-2003 03:21 AM
Language and Direction real GURU needed! (Hebrew and maybe arabic) CR or Charset issue? Efy. ASP .Net 2 06-25-2003 03:28 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57