[Solved by hack] UTF-8 encoding and FrontBase and Wonder
[Solved by hack] UTF-8 encoding and FrontBase and Wonder
- Subject: [Solved by hack] UTF-8 encoding and FrontBase and Wonder
- From: Thomas <email@hidden>
- Date: Sat, 17 Jun 2006 17:25:34 +1000
It turns out that despite all my code, the form value encoding was
always ISO8859_1 and so was some of the page encoding.
This is even after I called WOMessage.setDefaultEncoding("UTF8") in
the application constructor, and despite the fact that I had code
that set the content encoding and form value encoding to UTF-8 in
Application and Session for appendToResponse and
takeValuesFromRequest, and the logs show they were called.
The only solution I could find was to place, in every page that had a
form, appendToResponse and takeValuesFromRequest to set the content
encoding and form value encoding to UTF-8.
Since I did not have this problem in a test project that didn't use
Wonder, all I can think of is that something in Wonder is forcing the
encoding back to ISO8859_1.
Luckily, the entire project only has three top-level wrappers. All
the rest are subsidiary components. So I only had to add this hack in
three places. It would have been a real pain if I had more top-level
pages.
On 17/06/2006, at 6:50, Thomas wrote:
I am having trouble with character encoding in a WO application
that encodes all pages in UTF-8.
As instructed by "Practical WebObjects" I have added an Application
appendToResponse that sets the header to UTF-8. I've also added a
meta-tag for content-type.
Just to be paranoid, I added the UTF-8 setting code to
appendToResponse in Session and my component as well.
This works in an internally consistent way-- that is, I can enter
some Chinese text in a form field, store the text in the
Application, and display it in the page, and all looks OK, without
having to select the encoding in the browser. It also works if I
select UTF-8 in the browser. This works for Safari, Firefox, Camino
and Netscape, (but not for MSIE 5.2.3, not that this is a serious
problem). This is all on Mac OS X. Also, when I fetch the page
using cURL from the command line, the content displays correctly.
I can even save the text in a VARCHAR field in FrontBase, fetch it
back and display it in the page, and it looks OK.
However, it is not stored as UTF-8. When displayed in
FrontBaseManager or when browsing data in EOModeler, it looks like
rubbish.
One suspicious thing is that when I display the request from the
WOContext, it says the form encoding is ISO8859_1.
Another problem is that in another WO project that uses Project
Wonder, the same setup does NOT work, even without the database. If
I enter Chinese text in a from field, it is stored in the
Application as rubbish an is displayed as rubbish.
I don't know enough about encoding to see if any particular string
is correctly encoded, other than by looking at it on the screen.
I have tried
er.extensions.ERXRequest.BrowserFormValueEncodingOverrideEnabled=false
and =true
Any ideas? I don't really care about the database format, as long
as it is consistent across all the pages and displays as it is
entered in a text field.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40woomeranet.com.au
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