1616import org .apache .xerces .parsers .DOMParser ;
1717import org .eclipse .core .resources .IFile ;
1818import org .eclipse .core .resources .IProject ;
19+ import org .eclipse .core .resources .ResourcesPlugin ;
1920import org .eclipse .core .runtime .CoreException ;
2021import org .eclipse .core .runtime .IPath ;
2122import org .eclipse .core .runtime .Path ;
@@ -225,7 +226,7 @@ protected PHPToolLauncher getPHPToolLauncher(IProject project,
225226 .getSessionProperty (QUALIFIED_NAME );
226227 if (launcher != null ) {
227228 launcher .setCommandLineArgs (getCommandLineArgs (standard ,
228- prefs .getTabWidth ()));
229+ prefs .getTabWidth (), ResourcesPlugin . getEncoding () ));
229230 return launcher ;
230231 }
231232 } catch (CoreException e ) {
@@ -234,7 +235,7 @@ protected PHPToolLauncher getPHPToolLauncher(IProject project,
234235
235236 launcher = new PHPToolLauncher (QUALIFIED_NAME ,
236237 getPHPExecutable (prefs .getPhpExecutable ()), getScriptFile (),
237- getCommandLineArgs (standard , prefs .getTabWidth ()),
238+ getCommandLineArgs (standard , prefs .getTabWidth (), ResourcesPlugin . getEncoding () ),
238239 getPHPINIEntries (prefs , project , standard ));
239240
240241 launcher .setPrintOuput (prefs .isPrintOutput ());
@@ -279,7 +280,7 @@ public static IPath getScriptFile() {
279280 "/php/tools/phpcs.php" );
280281 }
281282
282- private String getCommandLineArgs (Standard standard , int tabWidth ) {
283+ private String getCommandLineArgs (Standard standard , int tabWidth , String encoding ) {
283284
284285 String args = "--report=xml --standard="
285286 + (standard .custom ? OperatingSystem
@@ -289,6 +290,9 @@ private String getCommandLineArgs(Standard standard, int tabWidth) {
289290 if (tabWidth > 0 )
290291 args += " --tab-width=" + tabWidth ;
291292
293+ if (encoding != null && !encoding .isEmpty ())
294+ args += " --encoding=" + encoding ;
295+
292296 return args + " " + PHPToolLauncher .COMMANDLINE_PLACEHOLDER_FILE ;
293297 }
294298}
0 commit comments