• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Content encoding in AJAX responses and Safari
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Content encoding in AJAX responses and Safari


  • Subject: Re: Content encoding in AJAX responses and Safari
  • From: "Oswaldo Bueno" <email@hidden>
  • Date: Fri, 1 Feb 2008 14:20:42 -0200

Ricardo,
   Have you tried to set the encoding at the application constructor?

    public Application() {

        /* The following line solved my encoding problems: */

        setDefaultEncoding("UTF-8");


        /* There is also this method that was suggested: */

ERXMessageEncoding.setDefaultEncodingForAllLanguages("UTF-8");

    }



Cheers,
   Bueno


On Feb 1, 2008 1:31 AM, Ricardo Parada <email@hidden> 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)

This email sent to email@hidden



--
-----------------------------------------------------------------------------------------
Oswaldo V. C. Bueno - http://bueno.carpintaria.com
Carpintaria do Software - http://www.carpintaria.com

 _______________________________________________
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

  • Follow-Ups:
    • Re: Content encoding in AJAX responses and Safari
      • From: Mike Schrag <email@hidden>
  • Prev by Date: Re: Null values at end of sorted list
  • Next by Date: Re: Content encoding in AJAX responses and Safari
  • Previous by thread: Re: Null values at end of sorted list (solved)
  • Next by thread: Re: Content encoding in AJAX responses and Safari
  • Index(es):
    • Date
    • Thread