16
16
import org .apache .xerces .parsers .DOMParser ;
17
17
import org .eclipse .core .resources .IFile ;
18
18
import org .eclipse .core .resources .IProject ;
19
+ import org .eclipse .core .resources .ResourcesPlugin ;
19
20
import org .eclipse .core .runtime .CoreException ;
20
21
import org .eclipse .core .runtime .IPath ;
21
22
import org .eclipse .core .runtime .Path ;
@@ -225,7 +226,7 @@ protected PHPToolLauncher getPHPToolLauncher(IProject project,
225
226
.getSessionProperty (QUALIFIED_NAME );
226
227
if (launcher != null ) {
227
228
launcher .setCommandLineArgs (getCommandLineArgs (standard ,
228
- prefs .getTabWidth ()));
229
+ prefs .getTabWidth (), ResourcesPlugin . getEncoding () ));
229
230
return launcher ;
230
231
}
231
232
} catch (CoreException e ) {
@@ -234,7 +235,7 @@ protected PHPToolLauncher getPHPToolLauncher(IProject project,
234
235
235
236
launcher = new PHPToolLauncher (QUALIFIED_NAME ,
236
237
getPHPExecutable (prefs .getPhpExecutable ()), getScriptFile (),
237
- getCommandLineArgs (standard , prefs .getTabWidth ()),
238
+ getCommandLineArgs (standard , prefs .getTabWidth (), ResourcesPlugin . getEncoding () ),
238
239
getPHPINIEntries (prefs , project , standard ));
239
240
240
241
launcher .setPrintOuput (prefs .isPrintOutput ());
@@ -279,7 +280,7 @@ public static IPath getScriptFile() {
279
280
"/php/tools/phpcs.php" );
280
281
}
281
282
282
- private String getCommandLineArgs (Standard standard , int tabWidth ) {
283
+ private String getCommandLineArgs (Standard standard , int tabWidth , String encoding ) {
283
284
284
285
String args = "--report=xml --standard="
285
286
+ (standard .custom ? OperatingSystem
@@ -289,6 +290,9 @@ private String getCommandLineArgs(Standard standard, int tabWidth) {
289
290
if (tabWidth > 0 )
290
291
args += " --tab-width=" + tabWidth ;
291
292
293
+ if (encoding != null && !encoding .isEmpty ())
294
+ args += " --encoding=" + encoding ;
295
+
292
296
return args + " " + PHPToolLauncher .COMMANDLINE_PLACEHOLDER_FILE ;
293
297
}
294
298
}
0 commit comments