Bug 204649 - DBCS: Wrong encoding used for Java files in generated web service
Summary: DBCS: Wrong encoding used for Java files in generated web service
Status: CLOSED FIXED
Alias: None
Product: WTP Webservices
Classification: WebTools
Component: wst.ws (show other bugs)
Version: 1.5   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: 3.0 M3   Edit
Assignee: Kelvin Cheung CLA
QA Contact: Kathy Chan CLA
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2007-09-26 03:16 EDT by Takehiko Ishii CLA
Modified: 2009-02-11 22:03 EST (History)
7 users (show)

See Also:


Attachments
Patch for setting charset for generated Java files (2.54 KB, patch)
2007-09-27 13:53 EDT, Kelvin Cheung CLA
bjorn.freeman-benson: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Takehiko Ishii CLA 2007-09-26 03:16:03 EDT
+++ This bug was initially created as a clone of Bug #134728 +++

I opened this defect as a clone of #132728 because I don't have the permission to reopen. Please see the contents of #134728 for detail about this problem.

This defect is opened as a defect in version 1.5 since the product that I'm testing uses WTP 1.5, but the same problem happens in WTP v2.0. 

The reporter of #134728 had reported a defect AXIS-2459 on Apache JIRA, then that eclipse defect had been closed. However I reopened this defect based on the comment from developer of the product.

----- comment from our product developer -----

The problem is in RAD/WTP, and the fact that AXIS does not rush to add the option to restore old behavior is not the reason to not fix it, or blame on AXIS.

I do not think it is necessary to change AXIS.  Invoker of WSDL2Java (which is WTP) should know its features - that AXIS version will emit Java in UTF-8 encoding.  The same code that invokes WSDL2Java should inform rest of Eclipse tools of that encoding by setting the encoding on the container where Java will be emitted.
WTP should make use of org.eclipse.core.resources.IContainer.setDefaultCharset(String charset, IProgressMonitor monitor) API, when invoking non Eclipse tool.


--------------------------------------

So, I would like to ask you to fix the problem using the method described in above.
Thanks.
Comment 1 Kathy Chan CLA 2007-09-26 14:40:39 EDT
Kelvin, could you please do some investigation on this problem?
Comment 2 Kelvin Cheung CLA 2007-09-26 16:47:38 EDT
Ishii-san,

I think I understand the problem but would need your confirmation because I don't have a Japanese machine to verify.

I was able to reproduce a similar problem on my English Windows machine where the default encoding is "Cp1252".  Under this encoding, the Java files have corrupted contents.

Using the IContainer.setDefaultCharSet API call is equivalent of doing a right-click -> properties -> Resource -> set the Text file Encoding to "UTF-8".

If we are doing this, we might be setting the encoding for the "src" folder.  Do you see any potential problems?

Regards,

Kelvin
Comment 3 Takehiko Ishii CLA 2007-09-27 02:13:30 EDT
Hello Kelvin,

Thanks for your prompt reply.
I think the potential problem is that an encoding mismatch might happen if WTP generates Web Service Java source in an existing Project that has Java source code already.

If existing source code is not written in UTF-8, changing src folder's encoding might affect these existing source code. If it is possible to change property of each generated file, it is better.

Thanks.
Comment 4 Kelvin Cheung CLA 2007-09-27 13:53:31 EDT
Created attachment 79303 [details]
Patch for setting charset for generated Java files

This patch set the charset for all Axis generated files to UTF-8.
Comment 5 Kathy Chan CLA 2007-10-30 17:01:17 EDT
Patch reviewed and tested.  Thanks Kelvin!

I've committed and released the change to HEAD as v200710302058.  It will be in the WTP 3.0 build.
Comment 6 Kathy Chan CLA 2008-02-28 14:12:16 EST
Please verify the defect you originated with a recent WTP driver which could be found in:

http://download.eclipse.org/webtools/downloads/

If defects in resolved state is not verified within a couple of weeks, the development team might verify and close the defect on the originator's behalf.  Thank you for your attention!

Comment 7 David Williams CLA 2008-04-24 00:45:20 EDT
mass change to add 'contributed' keyword based on bugzilla query, please correct if that's not accurate (by marking patches as obsolete and removing the 'contributed' keyword. 
Comment 8 Takehiko Ishii CLA 2008-06-10 08:40:41 EDT
verified using IES3.4_RC3 + wtp3.0_RC3_20080604.
Thanks!
Comment 9 Kathy Chan CLA 2009-02-11 22:03:47 EST
Closing defects in verify states.