Encode the part of the URL (search)

I want to be able to do a search on Google in a webview, by setting the URL "'https://www.google.com/search?&q= ' + 'Search'."

The problem is that if the query contains a sign, + it get interpreted as a space (which is happening in a few popular applications, including the browser of evolution).

I read that encodeURIComponent should solve this problem, so I changed the code for "'https://www.google.com/search?&q= ' + encodeURIComponent("+"), but research that results is actually % 2B."  Strangely, when I type the resulting URL in my computer, I get the correct result (a search of +).

import bb.cascades 1.2

Page {
    property string search: "https://www.google.com/search?&q=" + encodeURIComponent("+")
    Container {
        TextField {
            text: web.url
        }
    WebView {
        id: web
        url: search
    }
    }
}

This is the minimum project, I used to test my code.

Tags: BlackBerry Developers

Similar Questions

  • How to encode the URL in the Http Get method.

    Hi, I need to encode a url in the Http get method, I found URLEncodedPostData but that is used send message request can someone help me with this?

    Hi RexDoug,

    private String encodeUrl(String hsURL) {
            URLEncodedPostData urlEncoder = new URLEncodedPostData("UTF-8" , false);
            urlEncoder.setData(hsURL);
            hsURL = urlEncoder.toString();
            System.out.println(hsURL);
            return hsURL;
    }
    

    I tried thisbut it don't work I need to encode the url http get method.

    I used this code where I mention rules in URLEncodedPostData it works for me in coded form url in the get method.

    public String encodeUrl(String s){
            if (s!=null) {
                StringBuffer tmp = new StringBuffer();
                int i=0;
                try {
                    while (true) {
                        int b = (int)s.charAt(i++);
                        if ((b>=0x30 && b<=0x39) || (b>=0x41 && b<=0x5A) || (b>=0x61 && b<=0x7A) ||(b == 0x2F) || (b == 0x3A) || (b == 0x2D )|| (b == 0x2E)|| (b == 0x2C)|| (b == 0x3F)|| (b == 0x3D) ||(b == 0x26) || (b == 0x5F) || (b == 0x2A)) {
                            tmp.append((char)b);
                        }
                        else {
                            tmp.append("%");
                            if (b <= 0xf) tmp.append("0");
                            tmp.append(Integer.toHexString(b));
                        }
                    }
                }
                catch (Exception e) {}
                return tmp.toString();
            }
            return null;
    }
    
  • Some sites no longer works: Firefox 35 send url using a different strategy to encode the url of ff 34

    Hi *.
    I updated firefox to 34 to 35 and a site of mine (http://www.dolomiti.it) don't work propely anymore.
    If you are looking for a place we'll tell Merano for a given date, missing the date da.
    Debugging showed that the url

    http://www.Dolomiti.it/index.php?ID=4004 & user_ajaxsearch_pi1 [idZona] = & user_ajaxsearch_pi1 [idLocalita] = 207 & user_ajaxsearch_pi1 [type] = 2 & user_ajaxsearch_pi1 = 0 [idTema] user_ajaxsearch_pi1 [tipoStr] = - 1 & user_ajaxsearch_pi1 [star] = 0 & L = 0 & posit_booking [of] = 20/01/2015 & posit_booking [to] 21/01/2015 = & posit_booking [detail] = [{% 22Indice % 22:221% 22% 22Tipo % 22:221% 22% 22Persone % 22 [{: % 2218,18% 22, % 22Camere % 22: 221% 22}] & [nodate] posit_booking = 0

    will be sent to the web server coded as:

    http://www.dolomiti.it/index.php?id=4004 & user_ajaxsearch_pi1% 5BidZona % 5 d = & user_ajaxsearch_pi1% 5BidLocalita % 5 d = 207 & user_ajaxsearch_pi1% 5Btipo % 5 d = 2 & user_ajaxsearch_pi1% 5BidTema % 5 d = 0 & user_ajaxsearch_pi1% 5BtipoStr % 5 d =-1 & user_ajaxsearch_pi1% 5Bstelle % 5 d = 0 & L = 0 & posit_booking % 5Bfrom % 5 d = 20 - 01 - 2015 & posit_booking % 5Bto % 5 d = 21 - 01 - 2015 & posit_booking % 5Bdetail % 5 d = %5 B {% 22Indice % 22:221% 22% 22Tipo % 22:221% 22, % 22Persone % 22: % 2218,18% 22, % 22Camere % 22: 221% 22} 5% D & posit_booking % 5Bnodate %5 D = 0

    I looked in the Web server log, and I found that the url sent to the Web server in ff34 has been:

    http://www.Dolomiti.it/index.php?ID=4004 & user_ajaxsearch_pi1 [idZona] = & user_ajaxsearch_pi1 [idLocalita] = 207 & user_ajaxsearch_pi1 [type] = 2 & user_ajaxsearch_pi1 = 0 [idTema] user_ajaxsearch_pi1 [tipoStr] = - 1 & user_ajaxsearch_pi1 [star] = 0 & L = 0 & posit_booking [of] = 20/01/2015 & posit_booking [to] 21/01/2015 = & posit_booking [detail] = [{% 22Indice % 22:221% 22% 22Tipo % 22:221% 22% 22Persone % 22 [{: % 2218,18% 22, % 22Camere % 22: 221% 22}] & [nodate] posit_booking = 0

    Here's the query in the apache log:

    188.XX.XX.xx - [15/gen / 2015:09:37:55 + 0100] "GET index.php? id = 4004 & user_ajaxsearch_pi1 [idZona] = & user_ajaxsearch_pi1 [idLocalita] = 207 & user_ajaxsearch_pi1 [type] = 2 & user_ajaxsearch_pi1 [idTema] = 0 & user_ajaxsearch_pi1 [tipoStr] = - 1 & user_ajaxsearch_pi1 [star] = 0 & L = 0 & posit_booking [of] = 16/01/2015 posit_booking [to] posit_booking [detail] = [{% 22Indice % 22 & = 17/01/2015. «[{: 221% 22% 22Tipo % 22:221% 22% 22% 22Persone: % 2218,18% 22, % 22Camere % 22:221% 22}] & posit_booking [nodate] = 0 HTTP/1.1 "301 600"http://www.dolomiti.it/"" Mozilla/5.0 (Windows NT 6.3;" WOW64; (RV:34.0) gecko/20100101 Firefox/34.0.

    188.XX.XX.xx--[15/Gen/2015:09:42:06 + 0100] "GET index.php? id = 4004 & user_ajaxsearch_pi1% 5BidZona %5D = & user_ajaxsearch_pi1% 5BidLocalita %5 D = 207 & user_ajaxsearch_pi1% 5Btipo %5 D = 2 & user_ajaxsearch_pi1% 5BidTema %5 D = 0 & user_ajaxsearch_pi1% 5BtipoStr %5 D =-1 & user_ajaxsearch_pi1% 5Bstelle %5 D = 0 & L = 0 & posit_booking % 5Bfrom %5 D = 16-01 - 2015 & posit_booking % 5Bto %5 D = 17-01 - 2015 & posit_booking % 5Bdetail %5D = b 5% {%. «{22Indice % 22: 221% 22% 22Tipo % 22:221% 22% 22% 22Persone: % 2218,18% 22, % 22Camere % 22:221% 22} 5% D & posit_booking % 5Bnodate %5 D = 0 HTTP/1.1 "301 465"http://www.dolomiti.it/"" Mozilla/5.0 (Windows NT 6.3;" WOW64; (RV:35.0) gecko/20100101 Firefox/35.0 "

    Is this a bug?

    Thanks in advance,

    D.

    rifaccio said

    Fixed to 36.0

    https://Bugzilla.Mozilla.org/show_bug.cgi?id=1121826

  • Regular expression to remove a part of the URL

    I need do the following:

    "" Search for all URLS that contain" http://www.mycompany.com/dept/catalogs/ ' and remove whatever happened... / catalogs / '.

    Basically I have 3000 + links that start with " http://www.mycompany.com/dept/catalogs/" and I need to strip it of everything what they have after the part of the URL .../catalogs/.

    Anyone know of an automatic way to achieve this?

    Thanks in advance!

    In what programming environment you doing this?

    In find/replace DW?

    If so, then try this carefully on a test page, because I have not tested:

    To find:

    http:///\/www\.mycompany\.com\/dept\/catalogs\/[^\"]*\".

    Replace with:

    http://www.mycompany.com/Dept/catalogs/ ".

    If you need it in another environment, let us know.

    --

    E. Michael Brandt

    www.divaHTML.com
    www.divahtml.com/Products/scripts_dreamweaver_extensions.php
    According to the standard scripts and the Dreamweaver Extensions

    www.valleywebdesigns.com/vwd_Vdw.asp
    JustSo PictureWindow
    JustSo PhotoAlbum, and alia

    --

  • After a recently added update Firefox ' VISIT: url' / ' search: text "as the first result... can remove you that?

    Its quite annoying. It will simply display the URL for previously visited sites... but if I wanted to look for something... I would simply enter the text in the address bar now she suggested this little annoying thing that says to go directly to the URL.

    I have not controlled search suggestions and he always does.

    See the solution chosen to
    https://support.Mozilla.org/en-us/questions/1099785

  • How can I change the Focus of the URL bar for the Google search box?

    Hi guys,.

    I want to change the new direction of the tab in the URL bar of back to the google search box.

    How can I do?

    -Chris

    You can watch this extension:

  • Firefox doesn't load the URLS of sites window, but will charge by search engine

    Firefox will not load any site that I type in the URL window. It loads any location of the tile to start or Google search results page. But never directly.

    The problem started a week ago.

    The problem persists in safe mode. I have a few extensions and plug-ins (No Add ons) but I have not installed new in the last year.

    I uninstalled it and installed a clean place. I did a refresh. Hardware accelerator is disabled. The only thing I have not tried is to create a new profile.

    I'm running Win 7 Ultimate 64 (although Mozilla is x 86).

    My security system is provided by Zone Alarm, but it has been the case for at least five years and never had a problem before.

    Any suggestions?

    Thank you

    The most likely cause is a bug in Firefox that has not yet been set.
    You need to rename a particular profile data file. Your browsing history will be lost, but the browser working again. It is hoped that there will be a better fix in Firefox itself soon.

    Current fix suggested. (Bug 1180419 partner)
    Rename the places.sqlite file as explained in this recently revised article.

    For more details, please see

    P. S.
    Please post to say how you're going.
    I know it's rather unlikely survey solution.
    I don't know if this particular problem standard reinstall, reinstall clean same standard don't fix it not she. The Firefox update also does not resolve it.

  • How to disable "Search with" in the url bar in Firefox Developer?

    How to disable "Search with" in the url bar in Firefox Developer?
    Thank you

    Hi hamid, in order to change this enter on: config in the address bar of firefox (confirmed the message information where it appears) and search for the preference named browser.urlbar.unifiedcomplete. Double-click it and change its value to false.

  • Change the search engine to the url of the specific Web site

    I have the problem by changing the url of search engine for the url address bar and the search engine plugin. My version of Firefox is 35.

    Specifically, I want to use Google.co.uk for each search, but it goes to a country different from Google.

    I tried to change the subject: config-> keyword. URL: value: "https://www.google.co.uk/#q=", but it does not.

    I have tryied changing the search engine plugin, which does not work either.

    You need to install a search engine for your favorite country, then select this search engine in "Options/Preferences > Search" as the default search engine.

  • When I open a tab and start typing a URL in the address bar, my goal is switched to the google search field while I type.

    When I open a new tab in Firefox, usually the first thing I do is start typing a URL in the address bar to the new tab (normally that uses AutoComplete to sites that I visit a lot). The new tab usually displays a google search page which is fine. It's there if I need it.

    Lately, however, has changed the behavior of firefox when I open a new tab. After that I opened a new tab, my goal is taken from the address bar in the google search box. I mean not the Firefox search box either. I mean the search box on the google page. This occurs after I already started typing if I get the first letter or 2 of what I type in the search box, while the rest began to appear in the google search box. When I type a URL I want in the address bar. Not in the search box.

    On reflection, I think that there are a few extensions that try to block or reverse this behavior of the Google search page. If you check your extensions, are one of them suddenly disabled or missing?

    You can open the page modules using either:

    • CTRL + SHIFT + a
    • "3-bar" menu button (or tools) > Add-ons

    In the left column, click Extensions. Then check down to the disabled extensions.

  • How can I get rid of the google bar search and instead of showing the url I'm going too. So I can see if I have a https connection or not.

    I'm under 32.0.3 firefox but now don't see my URL address anymore I went too. I want to see if it is secure or not linking, and sometimes I might want to cut and paste the URL in a message, etc.. Everything I have now is a google search bar or you can choose from aol or other search engines.
    Thanks for any help. I've been a user of Firefox from the very first day, but if I can't resolve this I might have to bite the bullet and move on, I don't want to do.

    Can you post a screenshot?
    https://support.Mozilla.org/en-us/KB/how-do-i-create-screenshot-my-problem

  • Search Safari 9.1.1 does not work in the url field. Tabs are not securities.

    After I instaled 9.1.1 safari search option does not work since the URL field and tabs is not titles. IOS 10.11.5 macbook pro late 2011.

    Restart your Mac while holding down the SHIFT key. Secure boot is slow, so give it time to start your Mac completely and then restart normally.

  • Typing a wrong URL in the URL from Firefox 31.0 bar redirects me to us.yhs4 yahoo com search that displays the LAVASOFT logo. It is not the case with any of my

    Typing a wrong URL in the URL from Firefox 31.0 bar redirects me to us.yhs4 yahoo com search that displays the LAVASOFT logo. It is not the case with any of my other browsers (IE, Chrome, Opera, Safari). So this cannot be a problem ISP as shown in all current references to Firefox.
    This problem started after I uninstalled adaware from LAVASOFT. It itself instead of uninstall. Thus, it is malware behavior while LAVASOFT is pretending to protect against malware.
    Nevertheless, I would like to know how to get rid of this annoying 404 redirect hijack. My home page is about to startpage com, my default search engine is startpage com, all references to Lavasoft and adaware have been removed by subject: config and Windows registry...
    How to get rid of this spam redirect, please?

    Click Tools > Options, then general tab

    In the home page box, type the url you want to fire fox opens by default when you start the browser.

    KhalidXpert

  • How to change the size of the url and Google search boxes?

    I was able to change the size of the URL box, but not the Google search box. By doing so, I could show more extensions in the FF window.

    You can attach a screenshot to show what you are trying to reach?

    Use a type of compressed as PNG or JPG image to save the screenshot.

    Note that you must set a fixed width for the address bar and the search bar to disable their attributes of flex.

    Add code to the file userChrome.css below default @namespace.

    The file userChrome.css (UI) customization and userContent.css (Web sites) are located in the chrome folder in the Firefox profile folder.

    @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* only needed once */
    
    #urlbar-container { max-width:400px !important; }
    #search-container { max-width:200px !important; }
    
  • How can I stop my URL bar (upper center) to use the same search parameters such as my bar (top right) research

    I want my URL/address bar (the space upstairs in the Center) to use the google search when I type in, and I want the bar (the one top-right) research on Wikipedia, when I type in. She had previously worked like that, but suddenly firefox is no longer is allowing me to use different engines in the two areas.

    I've tried setting the keyword.url to 'http://www.google.com/search?ie=UTF-8 & oe = UTF - 8 & q =', but this setting is for some reason ignored and fails everything I put on the search bar. If I put the search bar for wikipedia the URL bar uses that, if I put to amazon the URL bar use instead.

    As I said, he worked the way I loved yesterday and today it is no longer. I have not modified parameters between yesterday and today that this would lead to.

    08-25 locking this thread - question and answer

    https://addons.Mozilla.org/en-us/Firefox/addon/keywordurl-hack/

Maybe you are looking for

  • How can I update my iPhone 4 to a 8.0

    I need help to update my software a 7.0 to a 8.0

  • Cannot send an email within iOS apps

    Hello- I use an iPhone running iOS version 9.2.1 6. I tried to send emails in apps on my iPhone and the emails are not being received. I am currently using Outlook as a mail client. For example, I go to the application of the New York Times and I wan

  • How to clean my keyboard Satellite M115-S3094

    I already posted this time. How to clean UNDER my keyboard on my Satellite M115-S3094? I really need to know how to get the keyboard up, or do I have to remove each key for this? Someone please help. Thank you...

  • Indicator SMS on BB9000 blackBerry Smartphones

    This happened after I have change the custom theme. When I get a new sms, I have two separate indicator yellow envelope top of the screen. so I thought it might be the theme, then when I change back to a default theme, same problem. I asked in anothe

  • How to disable the registry or command line network discovery / CMD?

    Hello We have 8 embedded windows. We don't want this popup about how to connect to a new network or router: There is no such GUI as shown here: http://Windows.Microsoft.com/en-us/Windows/enable-disable-network-discovery#1TC=Windows-7 We need to turn