Re: Content encoding in AJAX responses and Safari
Re: Content encoding in AJAX responses and Safari
- Subject: Re: Content encoding in AJAX responses and Safari
- From: Ricardo Parada <email@hidden>
- Date: Fri, 1 Feb 2008 12:10:01 -0700
Ok... I'm using Java 5. So I have changed "UTF8" to "UTF-8". Also I
changed the encoding in the .woo file to "UTF-8" instead of
NSUTF8StringEncoding.
However, I still get the characters displayed wrong with an ajax
response in Safari on Leopard.
All other browsers tested, i.e. Firefox on Windows / Leopard, as well
as IE7 and Safari on Windows work fine.
BTW, Mike, I was gonna try your suggestion but I think that assumes a
wonder application because I did not see setDefaultEncoding() in
WOApplication (which is what I'm subclassing in my app). So I
followed Pierre's suggestions.
On Feb 1, 2008, at 11:01 AM, Mr. Pierre Frisch wrote:
Let me repeat myself. With Java 5 encoding names have been
deprecated in favor of charset names. What this means is that Java
now follows the general convention and names should be spelled with
a "-" so use UTF-8 also NSUTF8StringEncoding is deprecated use
charset name. It used to be confusing where in some places you
needed the "-" and some other you did not need it, now just leave it
there. It works in all cases and it is consistent with the browsers.
Pierre
--
Pierre Frisch
email@hidden
On Jan 31, 2008, at 19:31, Ricardo Parada wrote:
Hi All,
I'm still testing my ajax stuff and I ran into this problem. My
main component has the following inside the <head>...</head> tags:
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
I also have eclipse preferences General > Workspace > Text file
encoding set to UTF-8. My Main.woo is as follows:
{
"WebObjects Release" = "WebObjects 5.0";
encoding = NSUTF8StringEncoding;
}
Then my application object overrides createRequest() to tell the
request as soon as possible that our form values are encoded in
UTF8 :
public WORequest createRequest(....) {
WORequest request = super.createRequest(...);
request.setDefaultFormValueEncoding("UTF8");
return request;
}
The application appendToResponse also does UTF8 for the content
encoding before generating the response:
public void appendToResponse(WOResponse response, WOContext
context) {
response.setContentEncoding("UTF8");
super.appendToResponse(response, context);
}
I can type in accentuated characters into the html file and the
page displays in the browser fine.
Also, in the text fields inside a form, I can type in these
characters, submit by clicking the submit button and the
application receives the characters and redisplays the page.
Everything displays correctly.
The problem comes in when I submit the values using AJAX. Again
the application receives the characters correctly. I check by
printing the values to the console. Then the application generates
an ajax response. I make sure to
response.setContentEncoding("UTF8") for my ajax response. The
response contains html. It's just an html fragment so it doesn't
have a <meta ...> tag in there.
On firefox the response displays correctly. However, on Safari my
ñ character turns into ñ
Then my é character turns into é
Any ideas why my ajax response doesn't display correctly in Safari?
Any ideas what I may be missing?
Thanks,
Ricardo
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden