Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 357650

Summary: broken special chars in PHP code templates
Product: z_Archived Reporter: Bastian Schaar <chi-yu>
Component: PDTAssignee: PHP Core <php.core-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: silviya
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Result when using "New" > "PHP File"
none
Result when using "New" > "Untitled PHP File" none

Description Bastian Schaar CLA 2011-09-14 11:41:37 EDT
Build Identifier: 20110301-1815

When creating a new PHP file, using the "Simple php file" code template, special characters such as German umlauts seem to be converted to ISO-8859-1 despite the workspace and file encoding being set to UTF-8.

Setting the file encoding of the newly created PHP file to ISO-8859-1 in the file properties will reveal the umlauts, indicating that they are indeed converted.

I also tried to override the template directly in "phpdefault-templates.xml" in "org.eclipse.php.ui_2.2.1.v20101001-2300.jar" using valid UTF-8 encoding and this didn't work either.

The preview looks okay, so the issue might be somewhere in the code which puts the template contents into the editor / file.

Reproducible: Always

Steps to Reproduce:
1. Edit the "Simple php file" template to include German umlauts.
2. Create a new PHP file using the "Simple php file" template.
3. Watch Eclipse messing up the encoding of the generated file content.
Comment 1 Zhongwei Zhao CLA 2013-01-29 22:28:27 EST
I change the template to :
<?php
${cursor}
echo "赵忠伟";

And it works fine,if this bug still exist,please send you sample,thanks!
Comment 2 Bastian Schaar CLA 2013-01-30 04:56:18 EST
Example:
<?php
/**
 * Short description
 *
 * Long description
 *
 * @version		$$Id$$
 * @internal	Encoding-check: >äöüÄÖÜ<. There shall be six umlauts within ><.
 */
${cursor}


Meanwhile, I found out that the bug only occurs when choosing "New" > "PHP File". It works fine when choosing "New" > "Untitled PHP File".
Comment 3 Bastian Schaar CLA 2013-01-30 04:59:52 EST
Created attachment 226301 [details]
Result when using "New" > "PHP File"
Comment 4 Bastian Schaar CLA 2013-01-30 05:00:25 EST
Created attachment 226302 [details]
Result when using "New" > "Untitled PHP File"
Comment 5 Zhongwei Zhao CLA 2013-01-31 01:23:08 EST
fixed
Comment 6 Sylvia Tancheva CLA 2015-02-17 09:35:28 EST
Verified. Umlauts appear just fine in new UTF-8 PHP files. Closing