title: Makefile/GCC struggles with special characters in path using Windows
body: <p>I've got the following makefile:</p>
  
  <pre><code>SRC = File1.cpp File2.cpp
  OBJECTS = $(patsubst %.cpp,$(GEN)/%.o,$(SRC))
  
  all: $(OBJECTS)
      @echo Packing objects: $(OBJECTS)
      $(AR) rcs $(GEN)/../libOutput.a $(OBJECTS)
  
  $(GEN)/%.o : $(GEN)/%.cpp
      @echo Compiling $&lt;
      $(CXX) -c $(CXXFLAGS) -O2 $&lt; -o $@
  </code></pre>
  
  <p>So, a pretty simple Makefile. Problem here is: The GEN variable is a Path given as an argument. If I now put is some korean characters to the Path, it is not working anymore.</p>
  
  <p>Following scenario:
  I've got the folder <code>D:\MakefileProblem\someASCIIpath</code> and there are two files <code>File1.cpp</code> and <code>File2.cpp</code>. By entering <code>make all GEN=D:\MakefileProblem\someASCIIpath</code>, everything works as expected.</p>
  
  <p>But if I have the same folder renamed to <code>D:\MakefileProblem\테스트문자열</code>, it doesn't work.</p>
  
  <p>In the output I can see, that the OBJECTS variable is filled correctly, but I can also see that the make targets for the objects aren't called:</p>
  
  <pre><code>Packing objects: D:\MakefileProblem\??????/File1.o D:\MakefileProblem\??????/File2.o
  arm-none-linux-gnueabi-ar rcs D:\MakefileProblem\??????/../libOutput.a D:\MakefileProblem\??????/File1.o D:\MakefileProblem\??????/File2.o
  arm-none-linux-gnueabi-ar: D:\MakefileProblem??????/File1.o: Invalid argument
  </code></pre>
  
  <p>The object files don't exist in the folder. Trying to call <code>make "D:\MakefileProblem\테스트문자열\File1.o" GEN="D:\MakefileProblem\테스트문자열"</code> just returns that there is missing a rule  to create the file (again: It's working on the ASCII path).</p>
  
  <p>I seem to have the same problem with the compiler, where I get an invalid argument error if I use Korean characters in the path.</p>
  
  <p>Windows tools seem to work fine (even though I just see question marks in the console instead of the actual characters).</p>
  
  <p>Question is now: How to resolve this issue, any ideas?</p>
  
  <p><strong>Update:</strong></p>
  
  <p>I noticed that problem does only occur on Windows. On Linux this Problem doesn't exist.</p>
  
  <p>Also I can observe the same behavior if I use diacritic characters, like <code>Ć</code>, in the path.</p>
  
  <p>Changing the Codepage to UTF-8 (<code>chcp.exe 65001</code>) did not work.</p>
  
  <p><strong>Update 2:</strong></p>
  
  <p>Knowing that MinGW (opposing to cygwin) leads to the same problem, it was a bit easier for me to get down to the real issue. It seems MinGW (and also the used compiler) doesn't support Unicode. As the calling of the Makefile is actually just a part of some integrated toolchain (with code generation and stuff, the enduser usually doesn't know anything about programming), I can check if the path is an ANSI compatible string. Now there are 2/3 possible options.</p>
  
  <ol>
  <li>The preferred one: Somehow convert the Unicode string to be
  compatible with Non-Unicode supporting programs (I doubt that is
  even possible, but if you know a way: Please let me know.)    </li>
  <li>Copy the files to a temp folder and do the compiling there, then
  copy the results back.    </li>
  <li>Inside the toolchain, throw an appropriate error.</li>
  </ol>
  
  <p>So if anyone knows if and how I can make an Unicode path working with programs that only support ANSI - I would be grateful.</p>