You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by O....@sh.cvut.cz on 2003/11/30 16:22:42 UTC

Upload with incorrect encoding

Hi, I have a little problem (I'm not sure, if it is problem of cocoon or pure 
java - if so, I apologize :). When I want to store into database binary data of 
uploaded file, many of characters are replaced by '?'. When I tried to store 
data to the file, everything was ok (it means, that from InputStream are going 
out relative correct characters). It looks like, that problem comes on by 
assigning of InputStream data to the String (I tried InputStreamReader with 
correct encoding also) and following storing into database for this reason 
fails.

What have I to do differently? Thanx a lot!

osup

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Upload with incorrect encoding

Posted by Geoff Howard <co...@leverageweb.com>.
Christian Haul wrote:

> O.Vobejda@sh.cvut.cz wrote:
> 
>> Db supports BLOBs, but I never did anything with them in java, less so 
>> cocoon :) Is it possible to use ESQL someways? Probably not, isn't it :) 
> 
> 
> ESQL and (modular) database actions support blob, clob types.
> AFAIR ESQL can only get them while the actions can insert and
> update them.

And there's an example of configuring the modular database actions 
(mod-db) to accept an uploaded file directly into a db blob.  No code - 
just configuration.  It's in the database block examples.

Geoff


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Upload with incorrect encoding

Posted by Christian Haul <ha...@informatik.tu-darmstadt.de>.
O.Vobejda@sh.cvut.cz wrote:
> Db supports BLOBs, but I never did anything with them in java, less so 
> cocoon :) Is it possible to use ESQL someways? Probably not, isn't it :) 

ESQL and (modular) database actions support blob, clob types.
AFAIR ESQL can only get them while the actions can insert and
update them.

	Chris.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Upload with incorrect encoding

Posted by O....@sh.cvut.cz.
Thanks for your answer. But I'd like to ask, if is possible to do it inside XSP 
script. I need to do much more stuff with the data of the upload form (another 
inserts, logic etc.) then just storing the file into db. I know, that it could 
I do with action too, but it's not as comfortable and straightforward as in 
XSP, I think. Thanx.

osup


> so you would need
> 1) action to retrieve uploaded file from the request (there are loads of
> examples on the wiki and mailinglist)
> 2) inside the action you would upload it into the database using sth like
> stmnt.setBytes(1, blobBytes) where blobBytes is a byte array with your
> file data.
> Retrieving the data should be very similar, check your jdbc docs for
> specifics.
> 
> Hope this helps
> Jorg
> 
> > Db supports BLOBs, but I never did anything with them in java, less so
> > cocoon :) Is it possible to use ESQL someways? Probably not, isn't it :)
> >
> > osup
> >
> > Cituji z emailu od Jorg Heymans <jh...@domek.be>:
> >
> >> Doesn't your database support the blob fieldtype? I am not sure why you
> >> store the inputstream in a string first.
> >>
> >> > Hi, I have a little problem (I'm not sure, if it is problem of cocoon
> >> or
> >> > pure
> >> > java - if so, I apologize :). When I want to store into database
> >> binary
> >> > data of
> >> > uploaded file, many of characters are replaced by '?'. When I tried to
> >> > store
> >> > data to the file, everything was ok (it means, that from InputStream
> >> are
> >> > going
> >> > out relative correct characters). It looks like, that problem comes on
> >> by
> >> > assigning of InputStream data to the String (I tried InputStreamReader
> >> > with
> >> > correct encoding also) and following storing into database for this
> >> reason
> >> > fails.
> >> >
> >> > What have I to do differently? Thanx a lot!
> >> >
> >> > osup
> >> >
> >> > ---------------------------------------------------------------------
> >> > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> >> > For additional commands, e-mail: users-help@cocoon.apache.org
> >> >
> >> >
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> >> For additional commands, e-mail: users-help@cocoon.apache.org
> >>
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > For additional commands, e-mail: users-help@cocoon.apache.org
> >
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Upload with incorrect encoding

Posted by Jorg Heymans <jh...@domek.be>.
so you would need
1) action to retrieve uploaded file from the request (there are loads of
examples on the wiki and mailinglist)
2) inside the action you would upload it into the database using sth like
stmnt.setBytes(1, blobBytes) where blobBytes is a byte array with your
file data.
Retrieving the data should be very similar, check your jdbc docs for
specifics.

Hope this helps
Jorg

> Db supports BLOBs, but I never did anything with them in java, less so
> cocoon :) Is it possible to use ESQL someways? Probably not, isn't it :)
>
> osup
>
> Cituji z emailu od Jorg Heymans <jh...@domek.be>:
>
>> Doesn't your database support the blob fieldtype? I am not sure why you
>> store the inputstream in a string first.
>>
>> > Hi, I have a little problem (I'm not sure, if it is problem of cocoon
>> or
>> > pure
>> > java - if so, I apologize :). When I want to store into database
>> binary
>> > data of
>> > uploaded file, many of characters are replaced by '?'. When I tried to
>> > store
>> > data to the file, everything was ok (it means, that from InputStream
>> are
>> > going
>> > out relative correct characters). It looks like, that problem comes on
>> by
>> > assigning of InputStream data to the String (I tried InputStreamReader
>> > with
>> > correct encoding also) and following storing into database for this
>> reason
>> > fails.
>> >
>> > What have I to do differently? Thanx a lot!
>> >
>> > osup
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>> > For additional commands, e-mail: users-help@cocoon.apache.org
>> >
>> >
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>> For additional commands, e-mail: users-help@cocoon.apache.org
>>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Upload with incorrect encoding

Posted by O....@sh.cvut.cz.
Db supports BLOBs, but I never did anything with them in java, less so 
cocoon :) Is it possible to use ESQL someways? Probably not, isn't it :) 

osup

Cituji z emailu od Jorg Heymans <jh...@domek.be>:

> Doesn't your database support the blob fieldtype? I am not sure why you
> store the inputstream in a string first.
> 
> > Hi, I have a little problem (I'm not sure, if it is problem of cocoon or
> > pure
> > java - if so, I apologize :). When I want to store into database binary
> > data of
> > uploaded file, many of characters are replaced by '?'. When I tried to
> > store
> > data to the file, everything was ok (it means, that from InputStream are
> > going
> > out relative correct characters). It looks like, that problem comes on by
> > assigning of InputStream data to the String (I tried InputStreamReader
> > with
> > correct encoding also) and following storing into database for this
> reason
> > fails.
> >
> > What have I to do differently? Thanx a lot!
> >
> > osup
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > For additional commands, e-mail: users-help@cocoon.apache.org
> >
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Upload with incorrect encoding

Posted by Jorg Heymans <jh...@domek.be>.
Doesn't your database support the blob fieldtype? I am not sure why you
store the inputstream in a string first.

> Hi, I have a little problem (I'm not sure, if it is problem of cocoon or
> pure
> java - if so, I apologize :). When I want to store into database binary
> data of
> uploaded file, many of characters are replaced by '?'. When I tried to
> store
> data to the file, everything was ok (it means, that from InputStream are
> going
> out relative correct characters). It looks like, that problem comes on by
> assigning of InputStream data to the String (I tried InputStreamReader
> with
> correct encoding also) and following storing into database for this reason
> fails.
>
> What have I to do differently? Thanx a lot!
>
> osup
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org