File tree 1 file changed +3
-3
lines changed
Filter options
src/Symfony/Component/DomCrawler
1 file changed +3
-3
lines changed
Original file line number Diff line number Diff line change @@ -127,8 +127,8 @@ public function add($node)
127
127
/**
128
128
* Adds HTML/XML content.
129
129
*
130
- * If the charset is not set via the content type, it is assumed
131
- * to be ISO-8859-1, which is the default charset defined by the
130
+ * If the charset is not set via the content type, it is assumed to be UTF-8,
131
+ * or ISO-8859-1 as a fallback , which is the default charset defined by the
132
132
* HTTP 1.1 specification.
133
133
*
134
134
* @param string $content A string to parse as HTML/XML
@@ -161,7 +161,7 @@ public function addContent($content, $type = null)
161
161
}
162
162
163
163
if (null === $ charset ) {
164
- $ charset = 'ISO-8859-1 ' ;
164
+ $ charset = preg_match ( ' //u ' , $ content ) ? ' UTF-8 ' : 'ISO-8859-1 ' ;
165
165
}
166
166
167
167
if ('x ' === $ xmlMatches [1 ]) {
You can’t perform that action at this time.
0 commit comments