GAE/J 日本語文字化け Patch

下記 URLにある C#のPatch JAVAC.EXEを作ったら、とりあえず文字化けなしに
Upload可能となりました。

http://groups.google.com/group/google-appengine-java/browse_thread/thread/1345bf330766d8be

That's great!
And I have an alternative way to fix this problem.

I wrote a simple tool to add the encoding argument to javac.exe.

Just rename javac.exe to javac1.exe, and rename the tool to javac.exe.

Here is the main part of the tool (wrote in C#):

static int Main(string[] args)
{
string arg = "";

var cmd = Environment.CommandLine;
arg = cmd.Substring(cmd.IndexOf(args[0]));

if (!arg.Contains(" -encoding"))
arg += " -encoding UTF8";
Console.WriteLine("argment:{0}", arg);

Process p = new Process();
p.StartInfo.FileName = "javac1.exe";
p.StartInfo.UseShellExecute = false;
p.StartInfo.Arguments = arg;

p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.CreateNoWindow = false;
p.Start();

while (true)
{
var msgStd = p.StandardOutput.ReadLine();
if (msgStd != null)
Console.WriteLine(msgStd);
var msgErr = p.StandardError.ReadLine();
if (msgErr != null)
Console.WriteLine(msgErr);

if (msgStd == null && msgErr == null)
break;
}

return p.ExitCode;
}