core-bundle/src/Resources/contao/widgets/TextField.php
protected function validator($varInput)
	{
		if (\is_array($varInput))
		{
			return parent::validator($varInput);
		}

		if (!$this->multiple)
		{
			// Convert to Punycode format (see #5571)
			if ($this->rgxp == 'url')
			{
				try
				{
					$varInput = Idna::encodeUrl($varInput);
				}
				catch (\InvalidArgumentException $e) {}
			}
			elseif ($this->rgxp == 'email' || $this->rgxp == 'friendly')
			{
				$varInput = Idna::encodeEmail($varInput);
			}
		}

		return parent::validator($varInput);
	}
protected function validator($varInput)
	{
		if (\is_array($varInput))
		{
			return parent::validator($varInput);
		}

		if (!$this->multiple)
		{
			// Convert to Punycode format (see #5571)
			if ($this->rgxp == 'url')
			{
				try
				{
					$varInput = Idna::encodeUrl($varInput);
				}
				catch (\InvalidArgumentException $e) {}
			}
			elseif ($this->rgxp == 'email' || $this->rgxp == 'friendly')
			{
				$varInput = Idna::encodeEmail($varInput);
			}
		}

		return parent::validator($varInput);
	}
Trim values

@param mixed $varInput

@return mixed