Re: serializing an object to a string
From: Helge Jensen (helge.jensen_at_slog.dk)
Date: 03/15/05
- Next message: Wayne: "Re: Formless application"
- Previous message: Kristof Thys: "Re: Problem: The underlying connection was closed: Unable to connect to the remote server"
- In reply to: Marco Herrn: "Re: serializing an object to a string"
- Next in thread: Marco Herrn: "Re: serializing an object to a string"
- Reply: Marco Herrn: "Re: serializing an object to a string"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 15 Mar 2005 16:07:58 +0100
Marco Herrn wrote:
> Hi Helge,
Hi.
> Helge Jensen wrote:
>> Marco Herrn wrote:
>>> Another problem is: Is UTF8 Encoding the correct one? Would be
>>> another encoding more appropriate?
I don't think any *particular* encoding is appropriate.
A good choice would be the one the SoapFormatter uses, but it's really
not required.
>> There is probably no reason to even set the encoding.
> But when converting the byte Array to a string I need to use a Encoding.
> Or is there a different way of this conversion?
Can't you store the serialized object without conversion? You are
introducing an interpretation.
Try thinking what about what would happen if you chose Base64
en/de-coding for the conversion between byte[] and string. It would
work, since the encoding of the xml-document is independent of the
string<->byte conversion.
You could look into the serialized byte[] and choose an encoding based
on the xml encondig-declaration (it would be the identity encoding), but
it's really better if you could just skip the conversion byte[] <-> string.
> Thanks for your code example. It works. But still lacks the conversion
> to a string. How can I convert the buffer _without_ converting the extra
> bytes at the end?
I think you should go out of your way, not to do that conversion.
--
Helge Jensen
mailto:helge.jensen@slog.dk
sip:helge.jensen@slog.dk
-=> Sebastian cover-music: http://ungdomshus.nu <=-
- Next message: Wayne: "Re: Formless application"
- Previous message: Kristof Thys: "Re: Problem: The underlying connection was closed: Unable to connect to the remote server"
- In reply to: Marco Herrn: "Re: serializing an object to a string"
- Next in thread: Marco Herrn: "Re: serializing an object to a string"
- Reply: Marco Herrn: "Re: serializing an object to a string"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|