Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import org.apache.xerces.parsers.DOMParser;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
Expand Down Expand Up @@ -225,7 +226,7 @@ protected PHPToolLauncher getPHPToolLauncher(IProject project,
.getSessionProperty(QUALIFIED_NAME);
if (launcher != null) {
launcher.setCommandLineArgs(getCommandLineArgs(standard,
prefs.getTabWidth()));
prefs.getTabWidth(), ResourcesPlugin.getEncoding()));
return launcher;
}
} catch (CoreException e) {
Expand All @@ -234,7 +235,7 @@ protected PHPToolLauncher getPHPToolLauncher(IProject project,

launcher = new PHPToolLauncher(QUALIFIED_NAME,
getPHPExecutable(prefs.getPhpExecutable()), getScriptFile(),
getCommandLineArgs(standard, prefs.getTabWidth()),
getCommandLineArgs(standard, prefs.getTabWidth(), ResourcesPlugin.getEncoding()),
getPHPINIEntries(prefs, project, standard));

launcher.setPrintOuput(prefs.isPrintOutput());
Expand Down Expand Up @@ -279,7 +280,7 @@ public static IPath getScriptFile() {
"/php/tools/phpcs.php");
}

private String getCommandLineArgs(Standard standard, int tabWidth) {
private String getCommandLineArgs(Standard standard, int tabWidth, String encoding) {

String args = "--report=xml --standard="
+ (standard.custom ? OperatingSystem
Expand All @@ -289,6 +290,9 @@ private String getCommandLineArgs(Standard standard, int tabWidth) {
if (tabWidth > 0)
args += " --tab-width=" + tabWidth;

if (encoding != null && !encoding.isEmpty())
args += " --encoding=" + encoding;

return args + " " + PHPToolLauncher.COMMANDLINE_PLACEHOLDER_FILE;
}
}