Reputation: 193
I have a visual studio project that contains Japanese string literals. This project can be built completely fine in a Japanese system (Japanese Windows XP) and an English Visual Studio 2010 IDE.
But if I build the project in an English system (English Windows XP) and English Visual Studio 2010 IDE, I get a lot of "error CS1009: Unrecognized escape sequence" errors.
What can be the possible cause of this? Can we configure Visual Studio 2010 to interpret the project as UTF8 based?
I looked everywhere and can't seem to find a solution.
Sample code:
try
{
//ƒRƒ“ƒo[ƒg‘Îۂ̃tƒ@ƒCƒ‹ƒŠƒXƒg•\Ž¦DlgŒÄ‚Ño‚µ&ˆ—ŽÀs
frmSelFiles = new frmSelectFile(strLoadPath, strSavePath);
frmSelFiles.ShowDialog(this);
}
catch(ConvertException ce)
{
throw ce;
}
catch(Exception e2)
{
// the gibberish strings are actually Unicode characters
// the CSC1009 error occurs here: \Ž
ConvertException ce = new ConvertException(e2,"ƒtƒ@ƒCƒ‹‘I‘ðƒ_ƒCƒAƒƒOƒ{ƒbƒNƒX‚ð•\Ž¦‚Å‚«‚Ü‚¹‚ñB");
throw ce;
}
finally
{
//ƒŠƒ\[ƒX‰ð•ú
if(frmSelFiles != null)
{
frmSelFiles.Dispose();
}
}
The solution:
I was able to resolve this by changing the default locale setting of the environment. For WinXP's case, we probably need to set the "Language for Non-Unicode Programs". In Win Server 2008 R2, I changed the default System locale.
It appears that MSBuild or MS Visual Studio (2010) takes the "Language for Non-Unicode Programs" setting.
Upvotes: 0
Views: 1104
Reputation: 100545
It looks like you have files saved in default Japanese encoding and as result they work fine when locale (or maybe "non-Unicode locale") set to matching encoding.
To my knowledge there is no way to configure C# compiler and VS to open such files in non default encoding.
You options:
Upvotes: 2