Skip to content

Square brackets in WebView URL Sources result in ERR_FILE_NOT_FOUND on Android #23690

@orecros

Description

@orecros

Description

I'm using a WebView like this

<WebView Source="{Binding Url}"/>
viewModel.Url = "https://google.com/[]"

and on android it shows an ERR_FILE_NOT_FOUND message.

I'm not sure if this needs to be fixed. a little googling https://stackoverflow.com/questions/40568/are-square-brackets-permitted-in-urls shows support for square brackets in URLs is mixed. and there's a simple workaround. This is a regression from xamarin however. I ran into this issue working with stripe, so it's likely others will as well.

Steps to Reproduce

No response

Link to public reproduction project repository

No response

Version with bug

9.0.0-preview.6.24327.7

Is this a regression from previous behavior?

Yes, this used to work in Xamarin.Forms

Last version that worked well

Unknown/Other

Affected platforms

Android, I was not able test on other platforms

Affected platform versions

Android

Did you find any workaround?

Replace the square brackets with their percentage encodings

viewModel.Url = "https://google.com/[]".Replace("[", "%5B").Replace("]", "%5D");

Relevant log output

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions