• 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: Bug of the ComponentContent UTF-8
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug of the ComponentContent UTF-8


  • Subject: Re: Bug of the ComponentContent UTF-8
  • From: Yoshihiko Mori <email@hidden>
  • Date: Thu, 13 Mar 2008 00:40:14 +0900

Hi Pierre,

1. version of Java:
$java -version
java version "1.5.0_13"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_13- b05-237)
Java HotSpot(TM) Client VM (build 1.5.0_13-119, mixed mode, sharing)


2. version of WebObjects: 5.4.1

3. version of MacOS X: 10.5.2

4. problems:
If I set the charset name to "UTF-8" in the Main.java, I get unexpected characters in the String01 when I input any Japanese words in the TextField01 and click the SubmitButton01.
If I set the charset name to "UTF8", I get normal Japanese words.
When I was using WebObjects 5.3 on the MacOS X 10.4, the "UTF-8" was not a problem.
I think that this problem is not because of the ComponentContent considering the test which I did recently.


5. my new test code (I will send binary by another mail for you.) :

//----- Main.java
package com.hfsys.components;

import com.webobjects.appserver.WOComponent;
import com.webobjects.appserver.WOContext;
import com.webobjects.appserver.WORequest;
import com.webobjects.appserver.WOResponse;

public class Main extends WOComponent {
	private static final long serialVersionUID = 1L;
	public String testStr01, testStr02;

public Main(WOContext context) {
super(context);
}

public WOComponent testSubmit(){
testStr02 = testStr01;
return null;
}

/** Set Japanese Encoding **/
public void takeValuesFromRequest(WORequest aRequest,WOContext aContext)
{
aRequest.setFormValueEncodingDetectionEnabled(true);
aRequest.setDefaultFormValueEncoding("UTF8");
super.takeValuesFromRequest(aRequest,aContext);
}


public void appendToResponse(WOResponse aResponse,WOContext aContext)
{
aResponse.setContentEncoding("UTF8");
super.appendToResponse(aResponse,aContext);
}
/** <--Set Japanese Encoding **/


}


//----- Main.html <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <title>Test</title> </head> <body> Test<br/> <webobject name="Form01"> <webobject name="TextField01"/> <webobject name="SubmitButton01"/> </webobject> <webobject name="String01"/> </body> </html>


//----- Main.wod
Form01: WOForm {}
String01: WOString { value = testStr02; }
SubmitButton01: WOSubmitButton { action = testSubmit; value = "保存"; }
TextField01: WOTextField { value = testStr01; }



//----- Main.woo { "WebObjects Release" = "WebObjects 5.0"; encoding = NSUTF8StringEncoding; }


//----- Main.api <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <wodefinitions> <wo wocomponentcontent="false" class="Main"> </wo> </wodefinitions>




Thanks,

Mori


On 2008/03/12, at 2:02, Mr. Pierre Frisch wrote:

What is the problem exactly? The name should be "UTF-8" with a dash. In Java 1.4 the API changed from encoding names to charset names. The charset name use the same convention as the Web. The encoding names are considered legacy by Sun but should still work for String conversion. Could give me more detail of exactly what the problem is? and which version of Java and WebObjects?

Thank you

Pierre
--
Pierre Frisch
email@hidden


On Mar 11, 2008, at 8:59, Yoshihiko Mori wrote:

Hi Chuck,

Thank you for your advice.
This was not a bug.
I changed the character set name from "UTF-8" to "UTF8" in the parent Component code as follows and it seems that it went well.
In the past the "UTF-8" was not a problem but it does not go well now.


/** for UTF-8 **/
public void takeValuesFromRequest(WORequest aRequest,WOContext aContext)
{
aRequest.setFormValueEncodingDetectionEnabled(true);
aRequest.setDefaultFormValueEncoding("UTF8");
super.takeValuesFromRequest(aRequest,aContext);
}


public void appendToResponse(WOResponse aResponse,WOContext aContext)
{
aResponse.setContentEncoding("UTF8");
super.appendToResponse(aResponse,aContext);
}
/** **/


Thanks.

Mori

On 2008/03/12, at 0:05, Chuck Hill wrote:

Hello Mori,


On Mar 11, 2008, at 12:31 AM, Yoshihiko Mori wrote:

Dear all,
Dear developers.

I found a bug in the WOComponentContent.

It is as follows:

1. I set the Meta header in the Component as follows:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>


2. I sent a String of UTF-8 in the WOTextField in the WOForm in the WOComponentContent in the Component.

3. I got unexpected code and I found the following log include the context().request() log:
content-type=[application/x-www-form-urlencoded]


4. If the WOForm is not included in the WOComponentContent, I got expected code and the log of context().request() is as follows:
content-type=[application/x-www-form-urlencoded; charset:UTF-8]


I think this behavior that the Component in the WOComponentContent does not get the charset of the Meta header is a bug.
I am developing with the MacOS X 10.5 + WebObjects 5.4.1 + WOLips 3.3.4984.


Could you fix it and give me any workaround?

Thanks.

Mori.

You can't just set the meta header, you need to tell WebObjects to use the UTF-8 encoding everywhere. This should help:


http://wiki.objectstyle.org/confluence/display/WO/Web+Applications-Development-Localization+and+Internationalization

Chuck

--

Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/products/practical_webobjects







_______________________________________________ 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
  • Follow-Ups:
    • Re: Bug of the ComponentContent UTF-8
      • From: "Mr. Pierre Frisch" <email@hidden>
References: 
 >Bug of the ComponentContent UTF-8 (From: Yoshihiko Mori <email@hidden>)
 >Re: Bug of the ComponentContent UTF-8 (From: Chuck Hill <email@hidden>)
 >Re: Bug of the ComponentContent UTF-8 (From: Yoshihiko Mori <email@hidden>)
 >Re: Bug of the ComponentContent UTF-8 (From: "Mr. Pierre Frisch" <email@hidden>)

  • Prev by Date: Re: Class 'Session' exists but is not a subclass of WOSession?
  • Next by Date: Re: NSMutableArray conflict
  • Previous by thread: Re: Bug of the ComponentContent UTF-8
  • Next by thread: Re: Bug of the ComponentContent UTF-8
  • Index(es):
    • Date
    • Thread