VAST Seaside and Ajax Serialization

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

VAST Seaside and Ajax Serialization

jtuchel
I have a long standing problem with VA Smalltalk and Seaside. It's been there since Seaside is supported on VA ST.

The problem is: if I do a serialize of a form or a single input field via Ajax, the contents of the field will always be received as UTF-8 even though my app is configured to deliver pages in ISO-8859-15.

Normal callbacks work like a charm, but not Ajax serialize()-calls like this:

html form: [
        html text: 'You can enter test text here:'.
        html textInput
            callback: [:txt| self serializedString: txt];
            with: (self serializedString ifNil: ['Häusle in Böblingen für 100 €']).
            html break.
        html anchor
            onClick: ((html jQuery ajax serializeForm),
            ...
            with: 'Serialize with Ajax'.
            ]

I have tried overriding almost every method in the system that sets the content type of pages, ajax calls, JSON gets etc. I also tried exchanging the WASstServerAdapters Null Codec vs. the GRVASTLatin1Codec, in probably all possible combinations, but the result on the server will always be the String 'HÀusle in Böblingen fÌr 100 €'.

Serializing twice will make things worse.

So my question is:
Has anybody found a solution for the problem (and no, setting the Application's charSet to utf-8 is no solution at all!).
Will we really have to wait for VA ST to come with UTF-8 Support to avoid this problem? If so, when is this going to happen. I will have to port our project to Pharo for an important demo if we don't see a solution for this soon...

Thanks for reading

Joachim


--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/va-smalltalk/-/2RRsGXT3wOAJ.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/va-smalltalk?hl=en.
Reply | Threaded
Open this post in threaded view
|

Test App and some more info

jtuchel
Hi,

I've prepared a Mini-Test Application and attached it here as a filein for VAST.

Once you've loaded the app, it will show an input field with the text 'Häusle in Böblingen für 100 €'. You can do a form submit by clicking on the submit button and see the results in the input field: the very same text as is was in the input field.
Clicking on the Link for Ajax Serialization renders the serialized string that was sent back to the server using jQuery and Ajax (XMLHttpRequest) You can clearly see that all the non-7 bit ASCII-characters get screwed, because the Browser (Firefox 7.0.1 in my case) sends them as UTF-8, although the page is rendered with a Charset setting of iso-8859-15.

I've spent quite a while on approaches to force the Ajax callback to send with 8859-15 encoding, but obviously haven't found a solution.

My guess is that this can only be solved by switching the app to utf-8 and adding a correct Codec (The "unfinished" GRVASTUtf8Codec) to the Sst Adapter.

...because implementing the same component in the latest Seaside-3.0.6 oneclick - Image works like a charm if the app is registered as a utf-8 application and the Comanche Adapter is switched to utf-8 encoding, while using an 8859-15 encoding in the Comanche Adapet shows the very same behaviour on Pharo as it does on VAST.

Any ideas?

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/va-smalltalk/-/JsgcpMu2W_MJ.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/va-smalltalk?hl=en.

JTSeasideSerializeBugApp.app (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: VAST Seaside and Ajax Serialization

Adriaan van Os-3
In reply to this post by jtuchel
Joachim.

Didn't look at your app. But we do

    html document addLoadScript: (
        html jQuery ajaxSetup
            scriptCharset:   'iso-8859-1';
            contentType: 'application/x-www-form-urlencoded; charset=iso-8859-1';
            yourself)

hth,
Adriaan.

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/va-smalltalk/-/yVUd6rZsMtEJ.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/va-smalltalk?hl=en.
Reply | Threaded
Open this post in threaded view
|

Re: VAST Seaside and Ajax Serialization

jtuchel
Hi Adriaan,

just once or in every render method?

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/va-smalltalk/-/wAeUC9HpcNYJ.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/va-smalltalk?hl=en.
Reply | Threaded
Open this post in threaded view
|

Re: VAST Seaside and Ajax Serialization

jtuchel
forget the question ;-) it's of course needed on every page where an ajax callback is used...

I'll give it a try immediately

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/va-smalltalk/-/C_JMGMu_LSEJ.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/va-smalltalk?hl=en.
Reply | Threaded
Open this post in threaded view
|

Re: VAST Seaside and Ajax Serialization

Adriaan van Os-3
In reply to this post by jtuchel
We add that once (on every page). (But we normally have just one page ware we replace elements.)

We also have it in our form tags: <form accept-charset="iso-8859-1" ...>

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/va-smalltalk/-/a1LVyyYVYhEJ.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/va-smalltalk?hl=en.
Reply | Threaded
Open this post in threaded view
|

Re: VAST Seaside and Ajax Serialization

jtuchel
In reply to this post by Adriaan van Os-3
Adriaan,

thanks for the snippet.

Unfortunately, it doesn't work either. The loadscript is being sent out, but has no effect. It should in theory be equivalent to what I did with adding a contentType and charset settings to each individual ajax call as suggested here: http://stackoverflow.com/questions/553463/jquery-ajax-character-encoding-problem which I've tried.

All variants show the same behaviour. I come to the conclusion that there's no way around implementing a correct Codec for the Server Adapter.

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/va-smalltalk/-/Xw0HykXBFbQJ.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/va-smalltalk?hl=en.
Reply | Threaded
Open this post in threaded view
|

Re: VAST Seaside and Ajax Serialization

jtuchel
In reply to this post by Adriaan van Os-3
The addition to the form tags should not be necessary any more. This was a Seaside bug back when 3.0 was fresh. I know because this was so far my one and only bug fix for Seaside ;-)

It has since been moved to WABasicFormTag>>#initialize and respects your charSet setting for the registered app or defaults to utf-8. So if you set the charSet of your app when registering, all the forms in the app use this charSet.



--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/va-smalltalk/-/zD-7s7dIJH4J.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/va-smalltalk?hl=en.
Reply | Threaded
Open this post in threaded view
|

Re: VAST Seaside and Ajax Serialization

Marten Feldtmann-2
In reply to this post by jtuchel
Just to summarize the problems:

Both in Squeak and VASmalltalk the answer enters the system as UTF8 values. Via special codec classes - available in Squeak - GRPharoUtf8Codec, Utf8TextConverter and GRPharoUtf8CodecStream, the results are converted back to Latin1 and presented to the program.

Right ?

Marten

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/va-smalltalk/-/h3vrlZk3uZMJ.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/va-smalltalk?hl=en.
Reply | Threaded
Open this post in threaded view
|

Re: VAST Seaside and Ajax Serialization

jtuchel
In reply to this post by jtuchel
Hi Marten,

I am not sure if that's the only reason, but it sounds a lot like it. I haven't checked which concrete classes are used in Pharo, but simply switching the Comanche Adapter's encoding (back) to utf-8 works, and that's exactly where on VAST the respective classes GRVast*Codec and GRVast*Converter come to play.

So in short: yes. If there was a working GRVastUtf8Codec and friends (which there isn't), I am sure it would work.

Joachim

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/va-smalltalk/-/DYnc_4Bve2YJ.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/va-smalltalk?hl=en.
Reply | Threaded
Open this post in threaded view
|

Re: VAST Seaside and Ajax Serialization

jtuchel
In reply to this post by Marten Feldtmann-2
Right!

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/va-smalltalk/-/5QG7MEB88hQJ.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/va-smalltalk?hl=en.
Reply | Threaded
Open this post in threaded view
|

Re: Test App and some more info

Marten Feldtmann-2
In reply to this post by jtuchel
Hello Joachim,

ok I made the stuff working - at least working with your example. I had to extend and change methods in GreaseVASTCore and rewrite parts of my ICU library to support that stuff....

But I am after all not sure, if that Utf8Codec and stream is working as it should be ....

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/va-smalltalk/-/Iv8XuWMnTq8J.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/va-smalltalk?hl=en.
Reply | Threaded
Open this post in threaded view
|

Re: Test App and some more info

jtuchel
Hi Marten,

good job. So you implemented the encoding stuff in GRVastUtf8encoder by using the ICU library?
Is your code available on VASTGoodies? 

Not that I am keen on using ICU, but if my prototype is going to be accepted, I may need a fast solution for this problem and cannot wait for Instantiations to ship something...

Joachim

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/va-smalltalk/-/Fv5TCDJwV10J.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/va-smalltalk?hl=en.
Reply | Threaded
Open this post in threaded view
|

Re: Test App and some more info

Marten Feldtmann-2
No, but I'll send it to you per eMail.

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/va-smalltalk/-/KbcxJx9VYRIJ.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/va-smalltalk?hl=en.