• Hi

    Is there a way to make a php.ini adjustment to allow for non-ascii characters in FILTER_VALIDATE_URL, as I am running a site with PHP7 and it doesn’t recognise é etc in a form that has a URL added with these characters.

    I’m not a programmer, so any help would be useful. A fix would be great.

Viewing 3 replies - 1 through 3 (of 3 total)
  • To answer your question precisely: “Note that the function will only find ASCII URLs to be valid; internationalized domain names (containing non-ASCII characters) will fail.” ref. – https://php.net/manual/en/filter.filters.validate.php

    Is there another way to do that? Probably. Let me look around and respond here soon.

    Others will have more experience with this than I do. Best I could find in my rudimentary research was this article:
    https://jkwl.io/php/regex/2015/05/18/url-validation-php-regex.html

    Hopefully, someone will have a more helpful answer.

    Moderator bcworkz

    (@bcworkz)

    AFAIK WordPress core does not use FILTER_VALIDATE_URL at all. I know several plugins do use it though. Sometimes there’s a work around and sometimes not. What plugin is the generating the form you are having trouble with? If it’s Contact Form 7, you can use the ‘wpcf7_is_url’ to override the filter results.

    What also would need to be determined is some sort of alternative filter algorithm that will at least correctly validate URLs with extended Latin chars if not any RFC3986 compliant URL.

    If the plugin you’re having trouble with does not offer a workaround like CF7 does, you would need to take up the issue with the plugin author.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘FILTER_VALIDATE_URL with Non-ascii’ is closed to new replies.