Build fails if LANG is set to a UTF8 locale

I normally have set the LANG environment variable to de_DE.utf8. However, this makes MonoDevelop (5.9.6 under Manjaro Linux 15.09) unable to start MSBuild process. Triggering a compilation yields the following error message in the build log:

Build failed. MSBuild process could not be started

I also see other strange behavior, e.g. "using System.Linq" higlighted red, although all assembly references are OK.

After some investigation, I found out, that the problem seems to be the Byte Order Mark (BOM), which is automatically generated for stdout and stderr in some cases and seems to be a problem for some inter process communications, as they redirect the stream output of a process and parse it, but don't expect the BOM at the beginning.

If I change the locale to de_DE (without .utf8), everything is OK. This is my current workaround.

I wrote the following simple code (with some copies from MonoDevelop code) to investigate the problem. You may find is useful or ignore it:

using System;
using System.Linq;
using System.Diagnostics;
using System.Threading;

class P

  public static void Main(string[] args)
    string responseKey = "[MonoDevelop]";
    var exe = "/usr/lib/monodevelop/bin/MSBuild/4.0/MonoDevelop.Projects.Formats.MSBuild.exe";
    var pinfo = new ProcessStartInfo (exe)
      UseShellExecute = false,
      CreateNoWindow = true,
      RedirectStandardError = true,
      RedirectStandardInput = true
    var process = new Process { StartInfo = pinfo };
    Console.WriteLine("Starting process " + pinfo.FileName);
    process.ErrorDataReceived += (sender, e) =>
      Console.WriteLine("Received error: {0}", e.Data ?? "<null>");
      if (e.Data == null) return;
      if (e.Data.StartsWith(responseKey, StringComparison.Ordinal))
        Console.WriteLine("Response Key found!");
        Console.WriteLine(string.Join(" ", from c in e.Data.Take(responseKey.Length) select ((int)c).ToString("X")));
        if (e.Data.Substring(1).StartsWith(responseKey, StringComparison.Ordinal))
          Console.WriteLine("Response Key found at position 1!");
    Console.WriteLine("Waiting for finish");