[Mono-dev] [PATCH] Use UTF-8 encoding for source files in mcs tree and for ChangeLogs

Kornél Pál kornelpal at gmail.com
Wed Aug 16 09:52:26 EDT 2006


Hi,

Note that I posted the patch for mcs tree uncompressed but it was too large 
and hasn't been approved to the list yet so I resend it zipped.

Currently source files (*.cs; *.vb) use different encodings:
- ASCII
- Latin 1
- UTF-8 (without BOM)
- UTF-8 (with BOM)

The same is true for ChangeLogs but there were mixed encodings as well.

Our mcs compile doen't recongnize UTF-8 without BOM so those files are
incorrectly compiled if they were in Latin 1.

All of our source files should use the same encoding to be consistent that
makes code more maintainable as well. UTF-8 without BOM seems to be a good
solution as it provides support for every possible Unicode character so this
is a long-term solution for the problem.

I used the attached Latin1ToUtf8.cs to convert the encoding of source files
but I revised each modified character to make sure that the file was
converted from the right encoding to UTF-8.

Additional modifications:

mcs/build/config-default.make: Use UTF-8 as the default encoding for
compilers
mcs/class/Managed.Windows.Forms/Makefile: Removed CODEPAGE as UTF-8 is the
default
mcs/class/Microsoft.VisualBasic/Makefile: Removed CODEPAGE as UTF-8 is the
default

Replaced unnecessary (same visual character) non-ASCII characters with ASCII
characters in:
mcs/class/Mono.GetOptions/GetOptTest/GetOptTester.cs
mcs/class/System.Drawing/Test/DrawingTest/Exocortex.DSP/src/ComplexF.cs
mcs/class/System.Drawing/Test/DrawingTest/Exocortex.DSP/src/Complex.cs
mcs/class/Microsoft.VisualBasic/Test/standalone/6797.vb

Note that removig BOM and the above replacements resulted in 129 more ASCII
files that were non-ASCII because of BOM or non-ASCII characters.

I think that there are no side effects of these patches but comments are
welcome.

Please review and approve the patches.

Kornél 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: changelog-utf8.zip
Type: application/x-zip-compressed
Size: 13521 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20060816/29e41a9a/attachment.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mcs-utf8.zip
Type: application/x-zip-compressed
Size: 18408 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20060816/29e41a9a/attachment-0001.bin 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Latin1ToUtf8.cs
Url: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20060816/29e41a9a/attachment.pl 


More information about the Mono-devel-list mailing list