Quantcast
Channel: RazorGenerator Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 525

Created Unassigned: Use Encoding.UTF8 instead of Encoding.Default [158]

$
0
0
When reading a source template, RazorGenerator currently uses `Encoding.Default`.

In `RazorHost.GenerateCode()`:


Stream stream = File.OpenRead(_fullPath);
using (var reader = new StreamReader(stream, Encoding.Default, detectEncodingFromByteOrderMarks: true))
{
results = engine.GenerateCode(reader, className: DefaultClassName, rootNamespace: DefaultNamespace, sourceFileName: _fullPath);
}

This can be easily tested by using the ellipsis (…) character in a template (ALT+0133), which gets transformed into:

WriteLiteral("�");

From Microsoft's [documentation][1] on `Encoding.Default`.

> Because all Default encodings lose data, you might use UTF8 instead.


[1]: http://msdn.microsoft.com/en-us/library/system.text.encoding.default%28v=vs.110%29.aspx

Viewing all articles
Browse latest Browse all 525

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>