diff --git a/ChangeLog b/ChangeLog index b72ef63..5aa4bf7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2014-03-27 German Arias + + * Framework/PCFileCreator.m: Be sure to use an UTF8 string for the user + name on Windows. + 2014-03-08 German Arias * Framework/PCFileManager.m (-isTextFile:): Rewrite this method to work diff --git a/Framework/PCFileCreator.m b/Framework/PCFileCreator.m index 5eb8573..6bc82c3 100644 --- a/Framework/PCFileCreator.m +++ b/Framework/PCFileCreator.m @@ -297,12 +297,26 @@ static NSDictionary *dict = nil; while ((subRange = [file rangeOfString:@"$USERNAME$"]).length) { +#ifdef WIN32 + // Be sure to use an UTF8 string. + [file replaceCharactersInRange: subRange + withString: [NSString stringWithCString: + [NSUserName() UTF8String]]]; +#else [file replaceCharactersInRange:subRange withString:NSUserName()]; +#endif } while ((subRange = [file rangeOfString:@"$FULLUSERNAME$"]).length) { +#ifdef WIN32 + // Be sure to use an UTF8 string. + [file replaceCharactersInRange: subRange + withString: [NSString stringWithCString: + [NSFullUserName() UTF8String]]]; +#else [file replaceCharactersInRange:subRange withString:NSFullUserName()]; +#endif } while ((subRange = [file rangeOfString:@"$PROJECTNAME$"]).length)