@@ -237,10 +237,19 @@ The crawler supports multiple ways of adding the content::
237
237
238
238
.. note ::
239
239
240
- When dealing with character sets other than ISO-8859-1, always add HTML
241
- content using the :method: `Symfony\\ Component\\ DomCrawler\\ Crawler::addHtmlContent `
242
- method where you can specify the second parameter to be your target character
243
- set.
240
+ The :method: `Symfony\\ Component\\ DomCrawler\\ Crawler::addHtmlContent ` and
241
+ :method: `Symfony\\ Component\\ DomCrawler\\ Crawler::addXmlContent ` methods
242
+ default to UTF-8 encoding but you can change this behavior with their second
243
+ optional argument.
244
+
245
+ The :method: `Symfony\\ Component\\ DomCrawler\\ Crawler::addContent ` method
246
+ guesses the best charset according to the given contents and defaults to
247
+ ``ISO-8859-1 `` in case no charset can be guessed.
248
+
249
+ .. versionadded :: 3.4
250
+ The charset guessing mechanism of the ``addContent() `` method was
251
+ introduced in Symfony 3.4. In previous Symfony versions, ``ISO-8859-1 ``
252
+ charset was always used.
244
253
245
254
As the Crawler's implementation is based on the DOM extension, it is also able
246
255
to interact with native :phpclass: `DOMDocument `, :phpclass: `DOMNodeList `
@@ -397,13 +406,13 @@ a :class:`Symfony\\Component\\DomCrawler\\Form` object that represents the
397
406
form that the button lives in::
398
407
399
408
// button example: <button id="my-super-button" type="submit">My super button</button>
400
-
409
+
401
410
// you can get button by its label
402
411
$form = $crawler->selectButton('My super button')->form();
403
-
412
+
404
413
// or by button id (#my-super-button) if the button doesn't have a label
405
414
$form = $crawler->selectButton('my-super-button')->form();
406
-
415
+
407
416
// or you can filter the whole form, for example a form has a class attribute: <form class="form-vertical" method="POST">
408
417
$crawler->filter('.form-vertical')->form();
409
418
0 commit comments