Bug 6320 - MonoDevelop incorrectly displays file in non-unicode encoding
Summary: MonoDevelop incorrectly displays file in non-unicode encoding
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Text Editor ()
Version: Trunk
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Mike Krüger
Depends on:
Reported: 2012-07-30 00:26 UTC by Lopatkin Ilja
Modified: 2012-07-31 09:06 UTC (History)
1 user (show)

Is this bug a regression?: ---
Last known good build:

Windows-1251 (122 bytes, text/plain)
2012-07-30 00:27 UTC, Lopatkin Ilja
UTF-8 (134 bytes, text/plain)
2012-07-30 00:27 UTC, Lopatkin Ilja

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Lopatkin Ilja 2012-07-30 00:26:59 UTC
Due to some strange behaviour of Resharper or Visual Studio some files in our project are saved in Windows-1251 instead of Unicode. For quite a long time MD fails to display such files.
I've attached two files, one in Windows-1251 and one in UTF-8, to demonstrate this behaviour.
Comment 1 Lopatkin Ilja 2012-07-30 00:27:25 UTC
Created attachment 2274 [details]
Comment 2 Lopatkin Ilja 2012-07-30 00:27:39 UTC
Created attachment 2275 [details]
Comment 3 Mike Krüger 2012-07-30 13:14:37 UTC
Which version of monodevelop are you using ?
Comment 4 Mike Krüger 2012-07-30 14:27:11 UTC
Should be fixed on master.

Our encoding dectection correctly detected it as an windows encoding, but choosed 1252 - I don't see a way to reliably detect 1251 <--> 1252.

I fixed it by defaulting to the default windows encoding on the machine that's used to open the file - which should be in your case 1251.

If you can update & build monodevevelop from github it would be very nice to hear some feedback, if it worked.

But due do the windows encoding codepage mess I really recommend using utf-8.

btw. I think vs.net just does the same & uses the machine default encoding - therefore the file should look differently on another machine using vs.net and another system language.
Comment 5 Lopatkin Ilja 2012-07-30 23:49:42 UTC
I was using two weeks old master branch from github.

With your last fix everything seems to work fine, thanks!
I know that using a regional encoding for source files is a bad thing, but as I said in a bug description, it should be some problem with Resharper or something like that. I don't have it installed on my machine, but it seems that after any refactoring it re-saves file with the default system encoding instead of the one from the VS settings.

P.S. It seems there's a little typo in your commit. Comment says that "on non windows system default to 1251 (western encoding)" but in fact function returns "1252".
Comment 6 Mike Krüger 2012-07-31 09:06:08 UTC
Fixed that - I'm atm at a conference and fixed it between the talks :)

I'm glad that the fix worked :)