Calling Msbuild from Php - Wrong Codepage and Culture
- by miasbeck
I have a Php script that calls Msbuild via System:
<?php
system( "msbuild umlaut.proj" );
?>
This is the project file:
<?xml version="1.0" encoding="UTF-8"?>
<Project
xmlns="http://schemas.microsoft.com/developer/msbuild/2003"
DefaultTargets="EchoUmlaut"
ToolsVersion="3.5">
<Target Name="EchoUmlaut">
<Message Text="Umlaute: Ä Ö Ü ä ö ü ß" />
</Target>
</Project>
When I call Msbuild directly from the command line the output of msbuild is in German (as excpected) and the umlauts come out OK (I chcp to 1252). But when I use php to call msbuild the umlauts are wrong, and the output of msbuild is changed to English. I wonder what I can do to prevent this.
C:\>chcp
Aktive Codepage: 1252.
C:\>msbuild umlaut.proj
Microsoft (R)-Buildmodul, Version 3.5.30729.1
[Microsoft .NET Framework, Version 2.0.50727.3607]
Copyright (C) Microsoft Corporation 2007. Alle Rechte vorbehalten.
Das Erstellen wurde am 13.04.2010 08:57:04 gestartet.
Projekt "D:\Cvsroot\projekte\e4elaui\v1.0\umlaut.proj" auf Knoten 0 (Standardziele).
Umlaute: Ä Ö Ü ä ö ü ß
Die Erstellung von Projekt "D:\Cvsroot\projekte\e4elaui\v1.0\umlaut.proj" ist abgeschlossen (Standardziele).
Das Erstellen war erfolgreich.
0 Warnung(en)
0 Fehler
Vergangene Zeit 00:00:00
C:\>php call_from_php.php
Microsoft (R) Build Engine Version 3.5.30729.1
[Microsoft .NET Framework, Version 2.0.50727.3607]
Copyright (C) Microsoft Corporation 2007. All rights reserved.
Build started 13.04.2010 08:57:11.
Project "D:\Cvsroot\projekte\e4elaui\v1.0\umlaut.proj" on node 0 (default targets).
Umlaute: Ž ™ š „ ” á
Done Building Project "D:\Cvsroot\projekte\e4elaui\v1.0\umlaut.proj" (default targets).
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:00