Be more specific on StreamWriter and template encoding to avoid EncoderFallbackException
This commit is contained in:
parent
1726eb9301
commit
87914ff327
@ -53,7 +53,7 @@ namespace Snap2HTML
|
|||||||
var sbTemplate = new StringBuilder();
|
var sbTemplate = new StringBuilder();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using( System.IO.StreamReader reader = new System.IO.StreamReader( System.IO.Path.GetDirectoryName( Application.ExecutablePath ) + System.IO.Path.DirectorySeparatorChar + "template.html" ) )
|
using( System.IO.StreamReader reader = new System.IO.StreamReader( System.IO.Path.GetDirectoryName( Application.ExecutablePath ) + System.IO.Path.DirectorySeparatorChar + "template.html", Encoding.UTF8 ) )
|
||||||
{
|
{
|
||||||
sbTemplate.Append(reader.ReadToEnd());
|
sbTemplate.Append(reader.ReadToEnd());
|
||||||
}
|
}
|
||||||
@ -102,8 +102,10 @@ namespace Snap2HTML
|
|||||||
// Write output file
|
// Write output file
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using( System.IO.StreamWriter writer = new System.IO.StreamWriter( settings.outputFile ) )
|
using( System.IO.StreamWriter writer = new System.IO.StreamWriter( settings.outputFile, false, Encoding.UTF8 ) )
|
||||||
{
|
{
|
||||||
|
writer.AutoFlush = true;
|
||||||
|
|
||||||
var template = sbTemplate.ToString();
|
var template = sbTemplate.ToString();
|
||||||
var startOfData = template.IndexOf( "[DIR DATA]" );
|
var startOfData = template.IndexOf( "[DIR DATA]" );
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<!DOCTYPE HTML>
|
<!DOCTYPE HTML>
|
||||||
<!-- saved from url=(0016)http://localhost -->
|
<!-- saved from url=(0016)http://localhost -->
|
||||||
<!-- This file was generated by [APP NAME] [APP VER] at [GEN DATE] [GEN TIME]. See [APP LINK] for more information -->
|
<!-- This file was generated by [APP NAME] [APP VER] at [GEN DATE] [GEN TIME]. See [APP LINK] for more information -->
|
||||||
<html>
|
<html>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user