• 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: WO, MySQL and UTF-8 issue
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: WO, MySQL and UTF-8 issue


  • Subject: Re: WO, MySQL and UTF-8 issue
  • From: 時期 精霊 <email@hidden>
  • Date: Thu, 16 Jun 2005 15:09:30 +0200

Hello,

fo me, your piece of code work well. If I do not force the charset I got garbage.

Are you sure to have that:

public void appendToResponse(WOResponse aResponse, WOContext aContext) {
aResponse.setContentEncoding("UTF8");
aResponse.setDefaultEncoding("UTF8");
aResponse.setHeader("text/html; charset=UTF-8; encoding=UTF-8", "content-type");
super.appendToResponse(aResponse, aContext);
}


public void takeValuesFromRequest(WORequest aRequest, WOContext aContext) {
aRequest.setFormValueEncodingDetectionEnabled(false);
aRequest.setDefaultFormValueEncoding("UTF8");
super.takeValuesFromRequest(aRequest, aContext);
}


if all your component?

The simplest thing is to make a subclass of WOComponent with the above code.

Regards

Kuon

On Jun 16, 2005, at 2:58 PM, François Reboursier wrote:


On Jun 16, 2005, at 12:37, 時期 精霊 wrote:
Never had problem with UTF-8, but just an advice to solve your problem.
Try to locate it. Save the user input in a file within java and verify that.
[...]
I cannot help you with mysql, but if java ouput wrong char, I can help.

I've juste tested this, and the result is puzzlling:
If I save the user input to a file, forcing the file encoding to UTF-8, the accented chars appear as garbage (code below)
If I save the same user user input without forcing the encoding, the content of the file is fine...


    Does this look normal to you?

    Regards,

François

===== Sample code 1====
File outputFile = new File("/tmp/encodingTest.txt");
FileOutputStream out = new FileOutputStream(outputFile);
OutputStreamWriter writer = new OutputStreamWriter(out, Charset.forName("UTF-8"));
writer.write(testObject.name());
writer.close();


=========================



_______________________________________________ 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
References: 
 >WO, MySQL and UTF-8 issue (From: François Reboursier <email@hidden>)
 >Re: WO, MySQL and UTF-8 issue (From: 時期 精霊 <email@hidden>)
 >Re: WO, MySQL and UTF-8 issue (From: François Reboursier <email@hidden>)

  • Prev by Date: Re: WO 5.3 and deploy on tomcat
  • Next by Date: Re: WO 5.3 and deploy on tomcat
  • Previous by thread: Re: WO, MySQL and UTF-8 issue
  • Next by thread: Re: WO, MySQL and UTF-8 issue
  • Index(es):
    • Date
    • Thread