mirror of
https://github.com/alexhopeoconnor/dnsmasq-webui.git
synced 2026-10-19 06:11:31 +10:00
Fix UTF-8 BOM in dnsmasq config/hosts writes so dnsmasq does not fail
- Add DnsmasqFileEncoding.Utf8NoBom for all config and hosts file writes - Strip BOM from first line when reading main config and managed config - Prevents 'bad option at line 1' when dnsmasq loads files written by the app
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
using System.Text;
|
||||
|
||||
namespace DnsmasqWebUI.Infrastructure;
|
||||
|
||||
/// <summary>Encoding for dnsmasq config and hosts files. UTF-8 without BOM so dnsmasq does not see a BOM as "bad option" on line 1.</summary>
|
||||
public static class DnsmasqFileEncoding
|
||||
{
|
||||
public static readonly Encoding Utf8NoBom = new UTF8Encoding(false);
|
||||
}
|
||||
Reference in New Issue
Block a user