imgtools/romtools/rombuild/r_build.cpp
changeset 626 ac03b93ca9c4
parent 590 360bd6b35136
child 699 9ca650050cf0
--- a/imgtools/romtools/rombuild/r_build.cpp	Thu Aug 12 09:00:16 2010 +0100
+++ b/imgtools/romtools/rombuild/r_build.cpp	Tue Aug 17 15:31:16 2010 +0800
@@ -35,7 +35,9 @@
 #include "r_global.h"
 #include "r_dir.h"
 
+#include "uniconv.hpp"
 TInt NumRootDirs;
+extern TBool gIsOBYUTF8;
 
 inline TLinAddr ActualToRomAddress(TAny* anAddr) { 
 	return TLinAddr(anAddr)-TheRomMem+TheRomLinearAddress; 
@@ -723,13 +725,32 @@
 iHardwareVariant(KVariantIndependent),iDataBssOffset(0xffffffff), 
 iStackReserve(0),iIATRefs(0), iNext(0), iNextInArea(0), 
 iRomImageFlags(0),iProcessName(0), iRomNode(NULL) {
-	if (aFileName){
+	if (aFileName)
+	{
 		if(iFileName)
 			delete []iFileName;
 		iFileName = NormaliseFileName(aFileName);	 
+   		if(gIsOBYUTF8 && !UniConv::IsPureASCIITextStream(iFileName))
+   		{
+			char* tempnname = strdup(iFileName);
+			unsigned int namelen = 0;
+			if(UniConv::UTF82DefaultCodePage(tempnname, strlen(tempnname), &iFileName, &namelen) < 0)
+				Print(EError, "Invalid filename encoding: %s\n", tempnname);
+			free(tempnname);
+   		}
 	}
 	if (aName)
+	{
 		iName = NormaliseFileName(aName);
+		if(!gIsOBYUTF8 && !UniConv::IsPureASCIITextStream(iName))
+		{
+			char* tempnname = strdup(iName);
+			unsigned int namelen = 0;
+			if(UniConv::DefaultCodePage2UTF8(tempnname, strlen(tempnname), &iName, &namelen) < 0)
+				Print(EError, "Invalid filename encoding: %s\n", tempnname);
+			free(tempnname);
+		}
+	}
 }
 //
 // Destructor