servicemix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Guillaume Nodet" <gno...@gmail.com>
Subject Re: Basic smx encoding principles
Date Tue, 02 Jan 2007 16:09:07 GMT
On 1/2/07, Anders Hammar <anders@hammar.net> wrote:
>
>
> gnodet wrote:
> >
> >> 1. Is incoming xml messages (through jmsBC or httpBC for instance) of any
> >> encoding (ISO-8859-1, UTF-8, UTF-16, etc.) supported?
> > All encodings should be supported (well, depending on the JVM of course).
> >
>
> Shouldn't be any problems with Sun's JDK, right? Could ActiveMQ have any
> impact?

All standard encodings are supported by all JVM afaik.
But for example, I'm not sure windows cp-1252 is supported on Unix platforms.

>
>
> gnodet wrote:
> >
> >> 2. Is the idea that all messages should be converted to one single
> >> encoding
> >> internally (UTF-8 by default)?
> > Hum ... I'm not sure this question really makes sense.  Let me explain.
> > Encoding is used to read and write strings from / to a byte array.  When
> > reading a byte array, the encoding will determine how these bytes are
> > converted to a character array.  Note that a single character is
> > represented
> > by a 16 bits word in memory.  So, once the string has been read, there is
> > no more any encoding: a string in memory is independent of the encoding
> > used to read it.  The same applies to xml, but one difference is that
> > the encoding
> > can be carried by the data itself: note that some combinations are not
> > valid
> > when parsing an xml from a byte[].
> >
>
> Ok. What troubles me is that the encoding of an xml message is defined in
> the xml header. If an xml messages is made into a UTF-8 encoded byte array
> but the xml header still states ISO-8859-1 as encoding, wouldn't that cause
> problems? As I understand it, smx never changes the xml header. Or is the
> header never used by smx or any dependant library?

Yeah, it may cause problems when parsing.  But the code who writes such
an xml should be corrected.  Honestly, I'm not sure what happens in all cases.
I guess it depends on the library used to output the xml (stax, xalan, ...).
I think such libraries should always output valid xml or throw exceptions.
For example when using xalan to transform an xml, the encoding
attribute on the xml PI is controlled by a property set on the transformer.


There may still be some bugs in servicemix though, where the encoding
is not used correctly, so that the data is corrupted (which is different than
the fact that the response encoding is not the same as the request encoding).

>
>
> Lots of thanks for clarifying this topic to me,
> /Anders
> --
> View this message in context: http://www.nabble.com/Basic-smx-encoding-principles-tf2907619s12049.html#a8125839
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>


-- 
Cheers,
Guillaume Nodet

Mime
View raw message