0

I have an url to scrape some products. But the url have a strange symbol :

https://www.hobbydb.com/marketplaces/hobbydb/catalog_items?utf8=✓&q=daredevil+sideshow&commit=Go

When i put it on my vb net code i have :

https://www.hobbydb.com/marketplaces/hobbydb/catalog_items?utf8=%E2%9C%93&q=daredevil+sideshow&commit=Go

And i cant find my products

1 try :

Dim s1 = $"https://www.hobbydb.com/marketplaces/hobbydb/catalog_items?utf8=✓&q={productsearch}+{brandsearch}&commit=Go"

Result is :

https://www.hobbydb.com/marketplaces/hobbydb/catalog_items?utf8=✓&q=+&commit=Go

2 try :

Dim s1 = $"https://www.hobbydb.com/marketplaces/hobbydb/catalog_items?utf8=%E2%9C%93&q={productsearch}+{brandsearch}&commit=Go"

Result is :

https://www.hobbydb.com/marketplaces/hobbydb/catalog_items?utf8=%E2%9C%93&q=+&commit=Go

This is my current code:

        'find product
        Dim productsearch = TextBox4.Text 'Product name
        Dim brandsearch = ComboBox1.Text 'Branch Product
        Dim s1 = $"https://www.hobbydb.com/marketplaces/hobbydb/catalog_items?utf8=%E2%9C%93&q={productsearch}+{brandsearch}&commit=Go" 'Url Search with Strings
        TextBox5.Text = s1 'Result
        'find product

I need Return Like :

https://www.hobbydb.com/marketplaces/hobbydb/catalog_items?utf8=%E2%9C%93&q=daredevil+sideshow&commit=Go

or

https://www.hobbydb.com/marketplaces/hobbydb/catalog_items?utf8=✓&q=daredevil+sideshow&commit=Go

Why i have that ?

1
  • URLs do not support un-encoded Unicode characters, only ASCII characters. So cannot appear un-encoded in a URL, it must be charset-encoded to bytes and then those bytes url-encoded in %HH hex format. %E2%9C%93 is the url-encoded UTF-8 form of . In a browser UI, you can type in and it will be encoded to %E2%9C%93 when transmitted to the web server. This is a common trick sites use to detect if a browser supports Unicode characters. Commented Oct 9, 2019 at 23:35

1 Answer 1

1

Done

'Dim encoded = HttpUtility.UrlPathEncode("http://zh.wikipedia.org/wiki/白雜訊")
    Dim productsearch = TextBox4.Text 'Product name
    Dim brandsearch = ComboBox1.Text 'Branch Product
    'Dim s1 = $"https://www.hobbydb.com/marketplaces/hobbydb/catalog_items?utf8=%E2%9C%93&q={productsearch}+{brandsearch}&commit=Go" 'Url Search with Strings
    Dim s1 = HttpUtility.UrlPathEncode($"https://www.hobbydb.com/marketplaces/hobbydb/catalog_items?utf8=✓&q={productsearch}+{brandsearch}&commit=Go") 'Url Search with Strings
    TextBox5.Text = s1 'Result
    'find product
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.