Commit 32895f9
committed
Changed how encoding is handled
Previously, to ensure that the XML delaration was being written, a `StringWriter` was used. `StringWriter` _always_ outputs `UTF-16`, however, regardless of what the `XDeclaration` is set to. That's a problem, as Sitemap.org _mandates_ `UTF-8` and e.g. Google will reject a sitemap that uses `UTF-16`. To mitigate this, the `StringWriter` is remoted and, instead, a simple approach is taken: simply declare a standalone `XElement` and serialize it to a string alongside the `XDocument`. (Note: Calling `ToString()` on an `XDocument` won't include the `XDeclaration`, which is why the `StringWriter` had previously been used.)1 parent c9319c2 commit 32895f9
1 file changed
Lines changed: 3 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
| 110 | + | |
| 111 | + | |
115 | 112 | | |
116 | 113 | | |
117 | 114 | | |
118 | 115 | | |
119 | | - | |
| 116 | + | |
120 | 117 | | |
121 | 118 | | |
122 | 119 | | |
| |||
129 | 126 | | |
130 | 127 | | |
131 | 128 | | |
132 | | - | |
133 | 129 | | |
134 | 130 | | |
135 | 131 | | |
| |||
0 commit comments