You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Zidarics Zoltan <za...@vili.pmmf.hu> on 2003/04/24 09:04:48 UTC

I am crazy to character encoding!

Hello All,

I have _permanent_ character encoding problem with bytea type fields in 
postgresql.
I send a lot of message to turbine_user and torque_user list but I didn't get 
any response.
I am out of my mind.

If I send _same_ string to varchar and longvarchar field, varchar is well 
coded, but longvarchar is not!
It seems to be both varchar and longvarchar handled like string in turbine and 
torque too.

In Action I tested:

    public void doInsert(RunData data, Context context)  throws Exception    {

    ...

       ZUtil.hexLog("posted 
data",data.getParameters().getBytes("longvarchartext"));
//     at this point hexlog is wellcoded
    ...
    ForumNotes entry = new ForumNotes();
    grpNotes.setProperties(entry);  // intake 
    ...
       ZUtil.hexLog("fieldvalue", entry.getFnText().getBytes() );
//     here is already wrong coded
    ...


This error only in longvarchar type fields _not_ in Varchar type fields!

Please give me some ideas, where can I start to debug this bug?
It is very important problem, because I cannot use turbine if it is not 
correct encoded.

-- 
thx,
----------------------------------------------------
Zoltan Zidarics programmer
PTE University Pecs, Hungary
icq: 43288694


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


Re: I am crazy to character encoding!

Posted by Zidarics Zoltan <za...@vili.pmmf.hu>.
Hello,

Eric Emminger at 2003. április 25. 17.01 wrote:
> Zidarics Zoltan wrote:
> > Hello,
> >
> > Eric Emminger at 2003. április 25. 16.31 wrote:
> >>>There is a form which is an _upload_ form, and in this case character
> >>>encoding is wrong too :-(
> >>
> >>Are you using the upload service or Commons FileUpload? I think those
> >>will help.
> >
> > No I am using turbine-2.2 which is using upload service.
> > Can I use commons fileupload in T2.2 or it is useable in T2.3?
>
> I don't know. I don't use either; I'm just aware that they exist.
ok, many thanks for your help, I'll try it.
-- 
thx,
----------------------------------------------------
Zoltan Zidarics programmer
PTE University Pecs, Hungary
icq: 43288694


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


Re: I am crazy to character encoding!

Posted by Eric Emminger <er...@ericemminger.com>.
Zidarics Zoltan wrote:
> Hello,
> 
> Eric Emminger at 2003. április 25. 16.31 wrote:
> 
>>>There is a form which is an _upload_ form, and in this case character
>>>encoding is wrong too :-(
>>
>>Are you using the upload service or Commons FileUpload? I think those
>>will help.
> 
> No I am using turbine-2.2 which is using upload service. 
> Can I use commons fileupload in T2.2 or it is useable in T2.3?
> 

I don't know. I don't use either; I'm just aware that they exist.

Eric


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


Re: I am crazy to character encoding!

Posted by Zidarics Zoltan <za...@vili.pmmf.hu>.
Hello,

Eric Emminger at 2003. április 25. 16.31 wrote:
> > There is a form which is an _upload_ form, and in this case character
> > encoding is wrong too :-(
>
> Are you using the upload service or Commons FileUpload? I think those
> will help.
No I am using turbine-2.2 which is using upload service. 
Can I use commons fileupload in T2.2 or it is useable in T2.3?

-- 
thx,
----------------------------------------------------
Zoltan Zidarics programmer
PTE University Pecs, Hungary
icq: 43288694


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


Re: I am crazy to character encoding!

Posted by Eric Emminger <er...@ericemminger.com>.
Zidarics Zoltan wrote:
> There is a form which is an _upload_ form, and in this case character encoding 
> is wrong too :-(

Are you using the upload service or Commons FileUpload? I think those 
will help.

Eric


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


Re: I am crazy to character encoding!

Posted by Zidarics Zoltan <za...@vili.pmmf.hu>.
Hello, 
Eric Emminger at 2003. április 24. 18.21 wrote:
> > I have _permanent_ character encoding problem with bytea type fields in
> > postgresql.
> > I send a lot of message to turbine_user and torque_user list but I didn't
> > get any response.
>
> I responded. :)
Oh thx! :-)

> > If I send _same_ string to varchar and longvarchar field, varchar is well
> > coded, but longvarchar is not!
>
> First, are you sure you need a *binary* string in PostgreSQL, rather
> than just a large normal-character string, such as text? The docs for
> PostgreSQL describe this.

Yes (!!) this was the great solve, I tried this. Unfortunately I am not a 
Postgresql expert. Now I changed longvarchar to clob, and it works good! Many 
thanks to you.

But I have a new problem :-) 

There is a form which is an _upload_ form, and in this case character encoding 
is wrong too :-(

I am using tomcat filter which is setting request.characterencoding to 
iso-8859-2 (thx to Maciej Leks)
http://archives.apache.org/eyebrowse/ReadMsg?listName=turbine-user@jakarta.apache.org&msgNo=9840

When I get character encoding in doInsert:
  
public void doInsert(RunData data, Context context) throws Exception {
     Log.debug(LOGHEADER+"doInsert enter, 
code:"+data.getRequest().getCharacterEncoding());
it is: iso-8859-2

and when I try to list values in hex, 
   ZUtil.hexLog("nishort:", data.getParameters().getBytes("nitem_0nishort"));
I get:
nishort: bytes:ffffffe1 72 76 ffffffed 7a 74 3f 72 3f 20 74 fffffffc 6b
 fffffff6 72 66 fffffffa 72 fffffff3 67 ffffffe9 70

first 3f is need to be an o with double acute, and second is need to be an u 
with double acute.

Are there any solving to do multipart form encoding well?

-- 
thx,
----------------------------------------------------
Zoltan Zidarics programmer
PTE University Pecs, Hungary
icq: 43288694


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


Re: I am crazy to character encoding!

Posted by Eric Emminger <er...@ericemminger.com>.
Zoltan

Zidarics Zoltan wrote:
> I have _permanent_ character encoding problem with bytea type fields in 
> postgresql.
> I send a lot of message to turbine_user and torque_user list but I didn't get 
> any response.

I responded. :)

> If I send _same_ string to varchar and longvarchar field, varchar is well 
> coded, but longvarchar is not!

First, are you sure you need a *binary* string in PostgreSQL, rather 
than just a large normal-character string, such as text? The docs for 
PostgreSQL describe this.

"A binary string is a sequence of octets that does not have either a 
character set or collation associated with it. Bytea  specifically 
allows storing octets of zero value and other "non-printable" octets."

http://www14.us.postgresql.org/users-lounge/docs/7.2/postgres/datatype-binary.html

Let me know whether or not you absolutely need to use the binary string 
bytea type. We'll go from there.

Eric


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org